Here is the way through Maze 138. The orange line shows Beep’s route from the top-left corner to the battery.

The route as arrow code
Each arrow is a direction and each number is how many squares to move. The whole route is 24 moves long and has 16 turns.
→ 2 ↓ 2 ← 1 ↓ 1 → 2 ↑ 1 → 1 ↓ 2 ← 1 ↓ 2 → 1 ↓ 2 → 2 ↑ 1 → 1 ↓ 1 → 1
Show the route step by step
- Go right 2 squares.
- Go down 2 squares.
- Go left 1 square.
- Go down 1 square.
- Go right 2 squares.
- Go up 1 square.
- Go right 1 square.
- Go down 2 squares.
- Go left 1 square.
- Go down 2 squares.
- Go right 1 square.
- Go down 2 squares.
- Go right 2 squares.
- Go up 1 square.
- Go right 1 square.
- Go down 1 square.
- Go right 1 square.
How would a computer solve this maze?
Computers solve mazes with an algorithm, a set of exact steps. One famous trick is called breadth-first search. The computer looks at every square one step from the start, then every square two steps away, then three, a bit like ripples spreading out when you drop a pebble in a pond.
When a ripple reaches the goal, the computer traces back the way it came. Because the ripples spread out evenly, the route it finds is always the shortest one. That’s how the orange line above was worked out!