Robot Program: U-Turn
Read the puzzle
A robot sits on a 5 by 5 grid. Number columns 1 to 5 from the left and rows 1 to 5 from the top. It starts at column 1, row 1, facing right. Row 2 has lettered tiles: B at column 1, D at column 2, A at column 3, C at column 5. Program: forward, forward, turn right, forward, forward, turn around, forward, turn left, forward. Forward moves 1 tile; turns are on the spot, to its own left or right. Which tile does it stop on?
Straight: 1 tile forward, the way it faces. Curved: turn on the spot. U: turn around. Which tile does it stop on?
Turns use the robot's own left and right, and a turn does not move it.
D
Right 2, down 2, back up 1, then left 1: tile D.
How to solve it
Step 1: track position and facing after every command. It starts in the top-left corner, column 1, row 1, facing right.
Step 2: run the program. Forward, forward: column 3, row 1. Turn right: from facing right, its right is down. Forward, forward: column 3, row 3. Turn around: now facing up, no move. Forward: column 3, row 2. Turn left: from facing up, its left is the left side of the grid. Forward: column 2, row 2.
Step 3: read the tile. Row 2 holds B in column 1, D in column 2, A in column 3 and C in column 5, so the robot stops on D.
The usual wrong answer is A, which is where the robot stands after the turn-around and one forward move. It is easy to stop there and miss the final left turn and step. Another slip is reading the U arrow as a quarter turn, which sends the robot off in the wrong direction.
The answer is D. Quick check: right 2, down 2, up 1, left 1 leaves it 1 column right of the start and 1 row down.