Skip to main content
added 13 characters in body
Source Link
MickyT
  • 12.3k
  • 2
  • 27
  • 49

Cubix, 2422 24 bytes

0 is truthy, nothing is falsey

@1O0I@0O1I!^/@.>u;r\.W<rq\?-p+qv;up+;;u 

Try it online!Try it online!

 @ 10 O 01 I ! ^ / @ . >W u< ; r \q .\ ? - p + ; q; vu ;. u. 

Watch it runWatch it run

The silly thing is that I have a solution that could be shorter, but it will only run on a 3x3x3 cubeI may be able to get a couple more out of this . I may be able to get a couple more out of this, but it's getting tight.. found them with a change to the initial redirect into the loop

  • I get the integer to check
  • ! check for 0 input
  • ^O@ if zero, output and halt
  • /01 initialise the stack for doing the sequence
  • >uW<W change lane onto the redirect and u-turnback to self, then change lane into the looping section
  • +p-? bring the check value to the top, subtract and check
  • /@ On a positive result reflect and halt
  • \^O@ On a zero result reflect, output and halt
  • vu;q\r;u;\qr; Remove the check, move check value to bottom, rotate the sum, remove the low value. Continue into loop.

Cubix, 24 bytes

0 is truthy, nothing is falsey

@1O0I!^/@.>u;r\.?-p+qv;u 

Try it online!

 @ 1 O 0 I ! ^ / @ . > u ; r \ . ? - p + q v ; u 

Watch it run

The silly thing is that I have a solution that could be shorter, but it will only run on a 3x3x3 cube. I may be able to get a couple more out of this, but it's getting tight.

  • I get the integer to check
  • ! check for 0 input
  • ^O@ if zero, output and halt
  • /01 initialise the stack for doing the sequence
  • >u redirect and u-turn into the looping section
  • +p-? bring the check value to the top, subtract and check
  • @ On a positive result halt
  • \^O@ On a zero result output and halt
  • vu;q\r; Remove the check, move check value to bottom, rotate the sum, remove the low value. Continue into loop.

Cubix, 22 24 bytes

0 is truthy, nothing is falsey

@0O1I!^/@.W<rq\?-p+;;u 

Try it online!

 @ 0 O 1 I ! ^ / @ . W < r q \ ? - p + ; ; u . . 

Watch it run

I may be able to get a couple more out of this ... found them with a change to the initial redirect into the loop

  • I get the integer to check
  • ! check for 0 input
  • ^O@ if zero, output and halt
  • /01 initialise the stack for doing the sequence
  • W<W change lane onto the redirect back to self, then change lane into looping section
  • +p-? bring the check value to the top, subtract and check
  • /@ On a positive result reflect and halt
  • \^O@ On a zero result reflect, output and halt
  • u;\qr; Remove the check, move check value to bottom, rotate the sum, remove the low value. Continue into loop.
Source Link
MickyT
  • 12.3k
  • 2
  • 27
  • 49

Cubix, 24 bytes

0 is truthy, nothing is falsey

@1O0I!^/@.>u;r\.?-p+qv;u 

Try it online!

 @ 1 O 0 I ! ^ / @ . > u ; r \ . ? - p + q v ; u 

Watch it run

The silly thing is that I have a solution that could be shorter, but it will only run on a 3x3x3 cube. I may be able to get a couple more out of this, but it's getting tight.

  • I get the integer to check
  • ! check for 0 input
  • ^O@ if zero, output and halt
  • /01 initialise the stack for doing the sequence
  • >u redirect and u-turn into the looping section
  • +p-? bring the check value to the top, subtract and check
  • @ On a positive result halt
  • \^O@ On a zero result output and halt
  • vu;q\r; Remove the check, move check value to bottom, rotate the sum, remove the low value. Continue into loop.