Skip to content
Thinking Games
EN
Planning

Program the Robot: how to solve a robot programming puzzle

In a robot programming puzzle you do not move the robot: you write its moves as a row of arrows, press a button and watch what happens. Everything is decided before the first step. This guide covers the two skills the puzzle asks for: running a program in your head, and spotting the short pattern that, repeated, covers a long route.

The rules, as the app states them

Write the moves, then press run.

  1. Tap the arrows to write the program. Each arrow moves the robot one square.
  2. Press Run to watch it. Hitting a rock or the edge stops the robot. Tap an arrow in the program to remove it.
  3. Collect every star before the target. When you see the repeat sign, the program starts over when it ends.

What kind of puzzle this is

The idea goes back to Logo, the language created in the late 1960s by Seymour Papert and his colleagues, in which children typed commands to steer a turtle. Arrow versions drop the typing and keep the core: a program is a list of instructions carried out in order, exactly as written, with no chance to correct it halfway.

That is the reasoning usually called computational thinking. You break a route into steps, look for the part that repeats, and when the result is wrong you find the one instruction that caused it.

The rules in detail

In Program the Robot you tap the four arrows to add instructions to the program. Each arrow moves the robot one square. The arrows are directions on the board, not turns: up always means towards the top of the screen, whichever way the robot came from.

  • Space. The program has a fixed number of slots. When it is full you have to remove an arrow before adding another. Tap any arrow in the program to remove it.
  • Run. Nothing moves until you press Run. Then the robot carries out the arrows from left to right.
  • Crashes. An arrow that points at a rock or off the board stops the run there. The game tells you which instruction did it.
  • Stars. The robot must drive over every star before the target counts. Crossing the target early is allowed and changes nothing.
  • Finishing. The run succeeds the moment the robot stands on the green target with every star collected, even if arrows are left over. The robot may cross the same square more than once.

Levels with the repeat sign add one rule: when the program reaches its last arrow, it starts again from the first, from wherever the robot is now. It keeps going until the robot reaches the target or crashes. A program that wanders without doing either is stopped after 40 moves.

Where to start: count before you write

Find the route with your finger first, then count it. How many squares up or down, how many left or right, and which rocks force a detour. Then compare with the slots you have.

  • If the route fits, the level is about sequence: write the arrows in the order the robot will need them.
  • If the route is much longer than the program, the level is about a loop: you need a short pattern that the repetition turns into the whole route.

Four techniques

1. Run it in your head

Before pressing Run, put a finger on the robot and move it one square per arrow, reading the program aloud if it helps. Programmers call this a dry run. It catches most mistakes, because the commonest one is an arrow that made sense for the route you imagined but not for the square the robot is really on.

2. Measure what one pass does

A repeating program shifts the robot by the same amount on every pass. Up, right, right always nets two squares right and one up. So compare that shift with the trip to the target: if the target is four right and three up, a pass of two right and one up is the right shape, and a pass of one right and one up is not, unless something else in the route makes up the difference.

3. Rotate the loop

The same arrows in a different starting order trace different squares. Up, right, right, right, up, right and right, right, up all climb the same slope, but the first begins by going up and the last begins with two steps right. The rocks decide which one survives. Remember too that the run can end in the middle of a pass: the target does not have to fall on the last arrow.

4. Fix one instruction, not the program

When the robot crashes, the message names the instruction. Everything before it worked. Change that arrow, or the one just before it, and trace again. Deleting the whole program throws away the part you had right.

A worked example with a loop

A board of four rows and five columns. The robot starts in the bottom left corner and the target is in the top right. There is a rock just to the right of the robot, another in the top row, third column, and a star in the second row, fourth column. The program holds three arrows and it repeats.

The board: R is the robot, ★ the star, T the target. Dark squares are rocks.
T
★
R
  1. Count. The target is four squares right and three up: seven moves. Three slots cannot hold that, so this is a loop.
  2. Try the simplest loop. Up, right makes a staircase. Trace it: up, right, up, right, and the next up points at the rock in the top row. It crashes. The staircase also climbs too steeply: it gains one row per column, and the target needs three rows over four columns.
  3. Find the right shape. Two rights and one up per pass. After two passes that makes four right and two up, which leaves the robot directly below the target with one up to go.
  4. Choose the order. That last move has to be an up, and it will be the first arrow of the third pass. So the program begins with up: up, right, right. The other two orders begin with right, straight into the rock beside the robot.
  5. Dry run. First pass: up, right, right, along the third row. Second pass: up, right onto the star, right to the last column. Third pass: up, onto the target. The run stops there, with two arrows of the pass unused.
The run. Each number is the move that lands on that square.
7 T
45 ★6
123
R

Three arrows, seven moves. No other program of three arrows or fewer solves this board.

Common mistakes

  • Checking only the first pass. A loop that starts well can crash on its second or third time round, when the robot is somewhere else.
  • Reading arrows as turns. Right does not mean turn right. It means one square towards the right edge of the board.
  • Forgetting the stars. A route that reaches the target without them does not finish: the robot drives over the target and carries on.
  • Expecting the robot to stop at the end of the program. In repeat levels it does not. If the last arrow leaves it one square short, the next pass begins.

How the difficulty grows in the app

Program the Robot has 120 levels. The first tutorial is a 3×3 board solved with four arrows in a row. The second gives you two slots on a 4×4 board and introduces the repeat sign. Easy levels are 4×4 and 5×5: most are straight sequences of five to eight arrows, sometimes with one star, and about a third are loops of three arrows. In medium levels, on 5×5 and 6×6 boards with one or two stars, loops become the norm. Hard levels are all 6×6 and all loops, of four to seven arrows, with up to three stars and more rocks. From the middle of the easy levels onwards the program has no spare slots: the shortest answer has to fit exactly.

A hint tells you the next arrow of a program that works and begins with what you have already written. If what you have written can no longer lead anywhere, it marks the instruction from which things go wrong. If your program already works, it simply tells you to press Run.

If you would rather draw the route directly, with a step limit in place of a program, try Clever Path. The rest of the collection is on the games page.

Frequently asked questions

What is a loop in a robot programming puzzle?

A set of instructions that is carried out again and again. In Program the Robot the whole program is the loop: when the last arrow has been done, the first one runs again from the robot's new position, until it reaches the target or crashes.

Do the arrows turn the robot?

No. Each arrow is a direction on the board. Up, right, down and left always mean the same thing, whichever way the robot has been moving.

Is there only one correct program?

Not necessarily. Any program that fits in the slots, collects every star and reaches the target solves the level. The space is often tight enough that few programs fit.

What does a puzzle like this teach about programming?

Three ideas that every programming language shares: instructions run in order, a loop repeats a pattern, and a wrong result is fixed by finding the instruction that caused it. It practises that way of reasoning. It does not teach a language.

More games in the collection