#Cubix , 38 bytes
Cubix , 38 bytes
/..?%?(O;0I:^.<.>;rrw+s;rUO?-<...O0L.@
/ . .
? % ?
( O ;
0 I : ^ . < . > ; r r w
+ s ; r U O ? - < . . .
O 0 L . @ . . . . . . .
. . .
. . .
. . .
0I: - sets up the stack with 0, n, n (s, n, d)
^ - start of the loop
)? - decrement d and test for 0. 0 exits loop
%? - mod against n and test. 0 causes ;rrw+s;rU which rotates s to top and adds d, rotates s to bottom and rejoins loop
;< - Cleanup and rejoin the loop.
On exiting loop
;< - Remove d from stack and redirect
-? - Remove n from s and test, 0 LOU@ turns left, outputs and exits, negatives 0O@ push zero, output and exits. positives ;O remove difference and outputs n. The path then goes through to the left turn which redirects to the @ exit
#Cubix , 38 bytes
/..?%?(O;0I:^.<.>;rrw+s;rUO?-<...O0L.@
/ . .
? % ?
( O ;
0 I : ^ . < . > ; r r w
+ s ; r U O ? - < . . .
O 0 L . @ . . . . . . .
. . .
. . .
. . .
0I: - sets up the stack with 0, n, n (s, n, d)
^ - start of the loop
)? - decrement d and test for 0. 0 exits loop
%? - mod against n and test. 0 causes ;rrw+s;rU which rotates s to top and adds d, rotates s to bottom and rejoins loop
;< - Cleanup and rejoin the loop.
On exiting loop
;< - Remove d from stack and redirect
-? - Remove n from s and test, 0 LOU@ turns left, outputs and exits, negatives 0O@ push zero, output and exits. positives ;O remove difference and outputs n. The path then goes through to the left turn which redirects to the @ exit
Cubix , 38 bytes
/..?%?(O;0I:^.<.>;rrw+s;rUO?-<...O0L.@
/ . .
? % ?
( O ;
0 I : ^ . < . > ; r r w
+ s ; r U O ? - < . . .
O 0 L . @ . . . . . . .
. . .
. . .
. . .
0I: - sets up the stack with 0, n, n (s, n, d)
^ - start of the loop
)? - decrement d and test for 0. 0 exits loop
%? - mod against n and test. 0 causes ;rrw+s;rU which rotates s to top and adds d, rotates s to bottom and rejoins loop
;< - Cleanup and rejoin the loop.
On exiting loop
;< - Remove d from stack and redirect
-? - Remove n from s and test, 0 LOU@ turns left, outputs and exits, negatives 0O@ push zero, output and exits. positives ;O remove difference and outputs n. The path then goes through to the left turn which redirects to the @ exit
#Cubix, 38 bytes
/..?%?(O;0I:^.<.>;rrw+s;rUO?-<...O0L.@
/ . .
? % ?
( O ;
0 I : ^ . < . > ; r r w
+ s ; r U O ? - < . . .
O 0 L . @ . . . . . . .
. . .
. . .
. . .
0I: - sets up the stack with 0, n, n (s, n, d)
^ - start of the loop
)? - decrement d and test for 0. 0 exits loop
%? - mod against n and test. 0 causes ;rrw+s;rU which rotates s to top and adds d, rotates s to bottom and rejoins loop
;< - Cleanup and rejoin the loop.
On exiting loop
;< - Remove d from stack and redirect
-? - Remove n from s and test, 0 LOU@ turns left, outputs and exits, negatives 0O@ push zero, output and exits. positives ;O remove difference and outputs n. The path then goes through to the left turn which redirects to the @ exit