11
$\begingroup$

A robot-control puzzle

The goal of this puzzle is to find a sequence of max 4 commands that will move the triangle through the maze and visit all colored squares.

Three types of commands can be used:

  • F0 makes the sequence start over.
  • The arrows (↑, ↱, ↰) move the triangle (forward) or make it change orientation (clockwise, anti-clockwise).
  • Xs change the color of the square the triangle is into the color of the X.

Each command can (but does not need to) have a color. A colored command is only executed if the triangle is in a square of the same color.

If you want to play around with the mechanics, you can do that here. (Disclaimer: I am one of the developers of the site.)

CLARIFICATIONS:

  • Attempting to move out of the board is not allowed.
  • The sequence terminates automatically once all squares have been visited.
$\endgroup$
2
  • $\begingroup$ What happens if I attempt to walk off the board? What I can glean from the reference it seems to just die, but I'd like that confirmed (in the answer text). $\endgroup$ Sep 12, 2019 at 13:33
  • $\begingroup$ Does the sequence of operations need to terminate, or is it OK to put the robot into an infinite loop provided it visits every square in the process? $\endgroup$
    – Gareth McCaughan
    Sep 12, 2019 at 13:56

1 Answer 1

7
$\begingroup$

This does it:

enter image description here

With the 'finishes when have covered all squares' clarification.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.