Skip to content

Hour of Code · Unplugged activity

Programming on a Map

20 min

Move a character across a grid using only direction commands, and discover what an algorithm really is.

start obstacle goal (carrot)

What it teaches

Sequencing and algorithms. A computer only does exactly what it is told, in order. Here you are the programmer and a classmate is the computer: you write a precise list of steps, they follow it to the letter. When the character misses the goal, you have found a bug, and fixing it is debugging.

What you'll need

  • A printed 5x5 grid (or draw one on paper or a whiteboard).
  • A start square, a goal (a carrot), and one obstacle to avoid.
  • Four command words: Up, Down, Left, Right.

How to run it

  1. 1

    Place the character on the start square and the carrot on another square. Add one obstacle square between them.

  2. 2

    One student is the programmer: they write a list of commands (for example: Right, Right, Up, Up) to move the character step by step.

  3. 3

    A second student is the computer: they read the list out loud and move the character exactly one square per command, no guessing.

  4. 4

    If the character hits the obstacle or misses the carrot, that is a bug. Find the wrong command, fix it, and run the program again.

  5. 5

    Swap roles and make it harder: more obstacles, a longer path, or a rule that the character may only turn, never move diagonally.

Try it now

The character starts bottom-left and the carrot is two squares right and two squares up, with an obstacle directly between them on the diagonal. Can you write a command list that reaches the carrot without crossing the obstacle? (One answer: Right, Right, Up, Up. Another: Up, Up, Right, Right. Both work; there is rarely only one correct algorithm.)

Talk about it

Ask the class: what happens if two commands are swapped? Real programs break the same way. Precise order is everything.

Developed by alphaPlan Center.

Found something unclear, outdated or improvable? Suggest an improvement