Missions

1
Cadet210XP

Control & Motion

Robot Maze Escape

Guided by Russ Tedrake

A robot is dropped in the middle of a maze. It can see one square ahead. Get it to the exit with the fewest moves.

30 min+130 XP

Watch

See it happen in the real world.

Real robots solve mazes by treating every step as a tiny plan. They imagine all the places they could go next, then pick the one that gets closer to the goal. The same trick — called pathfinding — runs in your video games, your maps app, and self-driving cars. There's a famous algorithm for it called A* (say 'A star'). It was invented in 1968 and we still use it. Russ Tedrake's lab uses fancier versions for robots that have to plan in 3D, like a humanoid stepping over a rope.

Think

A question worth sitting with.

If a robot can only see one square ahead, how does it know which way is closer to the exit?

Build

Make something with your hands.

Draw a 6x6 maze on graph paper. Place a 'robot' coin at the start. Move it one square at a time, writing down each move as up, down, left, or right. Your job is to write the shortest path.

Step-by-step

  1. On graph paper, draw a 6×6 grid. Mark a START square in one corner and an EXIT in the opposite corner.

  2. Draw walls between squares — about 10 walls is plenty. Make sure at least one path connects START to EXIT.

  3. Place a coin on START. The coin is your robot. The robot can only move up, down, left, or right.

  4. Write each move as a single letter: U, D, L, R. The list of letters is your robot's program.

  5. Run the program by moving the coin one square per letter. Did you reach EXIT? Count your moves.

  6. Now try to write a shorter program. Every move costs energy in a real robot — fewer moves means a smarter plan.

Try this in Scratch (or as pseudocode on paper)

Scratch (blocks)
when [green flag] clicked
  set x to 0
  set y to 0
  repeat until <touching [exit]?>
    if <not <wall to [right]?>> then
      change x by 1
    else if <not <wall [down]?>> then
      change y by -1
    end
  end
  say [I made it!] for 2 secs

Toolkit

  • Paper
  • Scratch

Play

Test it. See what it does.

Race a friend or family member. Each of you solves the same maze. The winner is whoever uses the fewest moves, not whoever finishes first.

Challenge

Push it a little further.

Solve the maze blindfolded. Have someone tell you only 'wall' or 'no wall' when you ask about a direction. Can your robot still find the exit?

Reflect

Notice what your robot taught you.

What would you improve about your maze-solving strategy?

Also ask yourself

What surprised you?

Reward

Mission outro

+0XP

There's always a next move. Keep going.

Skills advanced: motion planning, logic and loops

Badge

Maze Master

Explore another mission →