7
$\begingroup$

enter image description here

The goal is to find a sequence (a "program") of max 5 commands that will move the triangle (the "robot") through the grid and make it visit all the squares marked with a star.

Two types of commands can be used:

  • P0 makes the sequence start over.
  • The arrows (↑, ↱, ↰) move the triangle (forward) or make it change orientation (clockwise, anti-clockwise).

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.

Attempting to move out of the board is not allowed.

You can play with it here if you want (no signup required). I'm the dev.

(Hopefully, this one won't be as easy as the one from 2 weeks ago.)

$\endgroup$
3
$\begingroup$

The following program should work:

Forward if yellow -> Forward -> Forward -> Turn left -> Restart

| improve this answer | |
$\endgroup$
3
$\begingroup$

Alternative solution:

left - run on purple - run - right on green - repeat

| improve this answer | |
$\endgroup$
  • $\begingroup$ Oh! I thought if the bot runs out of the board, you loose. $\endgroup$ – Florian F Oct 12 at 20:32
  • $\begingroup$ @FlorianF Yes, but it won't because the game ends once the bot has cleared all the stars. $\endgroup$ – Paul Panzer Oct 12 at 20:39
  • $\begingroup$ Sorry, it is in fact as I first though, you can fall off. The colored instructions made it look like the bot bumps against the bottom border. So the solution is perfect. $\endgroup$ – Florian F Oct 12 at 20:47
  • $\begingroup$ @FlorianF No worries. $\endgroup$ – Paul Panzer Oct 12 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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