Skip to content
Programming Computational thinking
All classes Intermediate About 15 min Premium

Plan a route through a maze

Guide a robot through a 7 × 7 maze to its battery. Break the long route into short parts, find the block where a plan with a counting mistake breaks, and build the shortest plan.

Core concept

A big problem is easier when it is broken into small parts (decomposition); each part becomes a few steps, and a mistake in one part, such as one move too many, breaks the whole plan

Topic: Computational thinking

Long problems are easier in pieces. To cross a maze, you do not plan every step at once; you split the route into parts: “go up to the first gap”, “go right to the long corridor”, “go up again”. Each part becomes a few blocks: some moves, then a turn. This is called decomposition, and programmers use it for every big program. Pieces also make bugs easier to find: if the robot bumps into a wall, you check the part where it happened. One move too many in one part is enough to break the whole plan.

Key words explained

What you will learn

  • Break a long route into parts and write each part as blocks.
  • Find the part of a plan where it breaks, and fix it.
  • Count the moves and turns a route needs.
  • Find the shortest plan through the maze.

Before you start

  • Know how the robot's move and turn blocks work (see “Help the robot reach the battery”).

Materials

  • Squared paper to draw the maze and the route

Equipment

  • None

Procedure

  1. Run the starting plan and find where it bumps into a wall.
  2. Fix it, or build your own plan, so the robot reaches the battery.
  3. Make the plan as short as you can.
  4. Answer the practice challenges.
Premium experiment Create a free account