1 of 3

Perl 5, 111 + 1 (-p) = 112 bytes

@a=0..3*$_;$t=$a[$d=abs$a[$_]-$a[$_-1]],$a[$d]=$a[$s=$a[$_]+$a[$_-1]],$a[$s]=$t,push@r,$a[1]for 2..$_;$_=$r[-1]

Try it online!