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$

2 Answers 2

3
$\begingroup$

The following program should work:

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

$\endgroup$
3
$\begingroup$

Alternative solution:

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

$\endgroup$
4
  • $\begingroup$ Oh! I thought if the bot runs out of the board, you loose. $\endgroup$
    – Florian F
    Oct 12, 2020 at 20:32
  • $\begingroup$ @FlorianF Yes, but it won't because the game ends once the bot has cleared all the stars. $\endgroup$ Oct 12, 2020 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, 2020 at 20:47
  • $\begingroup$ @FlorianF No worries. $\endgroup$ Oct 12, 2020 at 21:00

Your Answer

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

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