Lesson 2: Step by Step — Writing Exact Grid Algorithms

Learning objective

Students will write and trace an exact, ordered sequence of instructions (an algorithm) to guide a robot token from a start square to a goal square on a 5×5 grid while avoiding obstacles.

Materials

Vocabulary

Allowed Robot Commands (Write on the board)

The robot only understands these four commands—nothing else:

  1. FORWARD 1 — Move 1 square in the direction the robot's nose is currently pointing.
  2. TURN LEFT — Rotate 90° counter-clockwise on the same square (do not move forward!).
  3. TURN RIGHT — Rotate 90° clockwise on the same square (do not move forward!).
  4. PICK UP — Pick up the star ★ on the current square.

Lesson flow

1. Warm-up: The Literal Teacher Robot (8 min)

  1. Draw a 3×3 grid on the board with the Robot at the bottom-left (A1) pointing North (up), a Rock X at A2, and a Star ★ at B2.
  2. Ask a volunteer to tell you how to get the star. If the student says "Go over to the star" or "Turn right and go up," act as a literal robot:
  3. On TURN RIGHT, rotate your arrow to face East (right) while staying on A1!
  4. Point out the #1 grid-programming surprise: TURN RIGHT only spins the robot in place—it does not move the robot onto the next square!
  5. Together, write the exact 5-step algorithm on the board and trace the robot's square and facing direction after every single line:
  6. TURN RIGHT (at A1, now facing East)
  7. FORWARD 1 (moves to B1, still facing East)
  8. TURN LEFT (at B1, now facing North)
  9. FORWARD 1 (moves to B2, facing North)
  10. PICK UP (picks up ★ at B2)

2. Direct instruction: Why Order (Sequence) Matters (10 min)

Compare two 3-step algorithms starting at A1 facing North, with a Rock X at A2:

Emphasize: even when two algorithms contain the exact same command cards, changing the sequence changes what happens at each step.

3. Guided practice: Programmer & Robot Grid Challenges (17 min)

Students work in pairs on their 5×5 grid (A1 is bottom-left, E5 is top-right):

Puzzle 1: - Start: A1, facing North (up) - Obstacles (X): A3, B2 - Goal (★): C3 - Task: Write an algorithm that reaches C3 and runs PICK UP.

Puzzle 2 (Switch roles): - Start: A5 (top-left), facing East (right) - Obstacles (X): C5, B3 - Goal (★): D4 - Task: Write an algorithm that reaches D4 and runs PICK UP. Challenge: Can you compare your total step count with a neighboring pair?

4. Wrap-up & Exit check (10 min)

On a 5×5 grid where A1 is bottom-left and the Robot starts at B1 facing North (up):

Row 3:  [A3]  [B3]  [C3]  [D3★]
Row 2:  [A2]  [B2]  [C2]  [D2]
Row 1:  [A1] [B1▲]  [C1]  [D1]

Answer these three questions:

  1. Trace this algorithm from B1 facing North:
  2. Step 1: FORWARD 1
  3. Step 2: TURN RIGHT
  4. Step 3: FORWARD 1
  5. Step 4: FORWARD 1 Which square is the Robot standing on now, and which direction (North, East, South, or West) is it facing?
  6. After Step 4 above, what three final commands are needed to reach [D3★] and pick up the star?
  7. Why doesn't TURN RIGHT move the robot from B2 to C2?

Worked answers for exit check

  1. After Step 1 (FORWARD 1), the robot is on B2 facing North. After Step 2 (TURN RIGHT), it is still on B2 facing East. After Step 3 (FORWARD 1), it is on C2 facing East. After Step 4 (FORWARD 1), it is on D2 facing East.
  2. The three final commands are: Step 5: TURN LEFT (now at D2 facing North), Step 6: FORWARD 1 (moves to D3), and Step 7: PICK UP.
  3. Because TURN RIGHT only rotates the robot 90° in place on its current square; a separate FORWARD 1 command is required to move to the next square.