Reeborg must show that it can multiply two numbers by taking a number N tokens located at x=1 and y=Y, and leave a single token at row y=1 and x = N*Y. For example, here's a starting position (image taken from RUR-PLE, so that it looks a bit different from the web version)
the final position must be
where a single token must be deposited.
So, without using numerical variables, and using only a single instruction per line (so no use of semi-colon, or having a colon followed by a statement), how short can a solution to this problem be? Here's an example of a solution that is NOT allowed under the above rules:
think(0) select_challenge("mul5x1") y = 1 # numerical variables not allowed tokens = 0;turn_left() # use of ; is not allowed def turn_around(): turn_left() turn_left() while not token_here(): move() y += 1 # not allowed while token_here(): take() tokens += 1 # not allowed turn_around() while front_is_clear(): move() # not allowed, statement after colon turn_left() repeat(move, y*tokens-1) # not allowed, multiplication put()
The solution must work for 5 different challenges (mul5x1, mul1x5, mul5x5, mul4x3, mul3x2) - or any other such challenges for which I could create a world. Excluding the line with think(0), which makes Reeborg move as quickly as possible, and the line select_challenge(...), can you write a solution shorter than 29 lines? Solutions can be attempted at Reeborg's World. You may want to click on the help button to see a brief summary of all known instructions.