For teachers
Hour of Code, teaching pack
Everything you need to run these activities with a class, on paper. Print this page or save it as a PDF.
Sharing one computer? Progress is saved per browser, not per student. At the end, each student should use Download my progress on the Learn page and Import it next time.
Training a team at work rather than a class? The run-it kit has a 30-minute plan, a wrap-up checklist and a printable completion record, and the business path gathers what a small workplace needs.
1. Programming on a Map20 min
Move a character across a grid using only direction commands, and discover what an algorithm really is.
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 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
- Place the character on the start square and the carrot on another square. Add one obstacle square between them.
- One student is the programmer: they write a list of commands (for example: Right, Right, Up, Up) to move the character step by step.
- A second student is the computer: they read the list out loud and move the character exactly one square per command, no guessing.
- 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.
- Swap roles and make it harder: more obstacles, a longer path, or a rule that the character may only turn, never move diagonally.
Worked example
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.)
Discussion
Ask the class: what happens if two commands are swapped? Real programs break the same way. Precise order is everything.
2. Programming the Math Sheet15 min
Turn a blank grid into a picture by following movement and colour commands, one square at a time, and see that every image is just data.
What it teaches
That images are data, and that precise instructions produce precise output. The screen of any device is a grid of tiny squares (pixels). Here you are the programmer: you write a list of symbols, and anyone who follows it to the letter gets exactly the same picture. Change one command and the picture changes; forget one colour command and a pixel stays blank.
What you need
- Squared paper, or draw a 5x5 grid on paper or a whiteboard.
- A pencil and one colour to fill in squares.
- A symbol legend: star = start square, arrows = move (up, down, left, right), filled square = colour this cell.
How to run it
- Agree on the legend together: a star marks where the pen starts, each arrow slides the pen one square in that direction, and a filled-square command means colour the square the pen is on now.
- One student is the programmer and writes a short list of commands. A second student is the computer and follows them exactly, one command at a time, never guessing what the picture should be.
- The computer moves an imaginary pen across the grid. On every colour command they fill the current square; on every arrow they slide one square and colour nothing.
- Compare the finished grid with the picture the programmer had in mind. Any wrong or missing square is a bug: find the command that caused it and fix the list.
- Swap roles. Try a bigger picture, or hand your command list to someone who has not seen the drawing and check whether they can reproduce it exactly.
Worked example
Try drawing a plus sign on a 3x3 grid. Start in the middle square and run: Colour; Up, Colour; Down, Down, Colour; Up, Left, Colour; Right, Right, Colour. The pen fills the centre, then the top, bottom, left and right squares, leaving the four corners blank, a neat plus. Now change one arrow and watch the plus break, that is exactly how a single wrong pixel appears on a real screen.
Discussion
Ask the class: if a photo is millions of tiny coloured squares, what is the computer really storing? Just numbers. Every image, on every screen, is data that an instruction wrote down.
3. How Does a Computer Think?20 min
Add up every number from 1 to 12 without adding them one by one, and learn the four thinking steps behind every program.
What it teaches
Computational thinking, the way a programmer breaks a problem apart before touching a keyboard. It has four moves: decomposition (split a big problem into smaller ones), pattern-finding (spot what repeats), abstraction (drop the details that do not matter and keep the rule), and algorithm (write the exact steps that solve it). A computer is fast but not clever; this thinking is the part that is yours.
What you need
- A whiteboard or paper with the numbers 1 to 12 written in a row.
- Something to draw arcs linking pairs of numbers; a coloured pen helps.
- No calculators. The whole point is to avoid adding by brute force.
How to run it
- Decomposition. Start with the whole task, add 1+2+3 and so on up to 12. Adding twelve numbers one after another is slow and easy to get wrong, so break it into a smaller job you can repeat.
- Pattern-finding. Pair the smallest number with the largest: 1+12. Then 2+11, then 3+10. Every pair adds up to the same thing, 13. That repetition is the pattern.
- Abstraction. Now drop the specific numbers and keep only the rule: there are six such pairs, and each one is worth 13. The individual numbers no longer matter.
- Algorithm. Turn the rule into steps: count the pairs (6), multiply by the pair total (13), and you get 6 × 13 = 78. Check it any other way you like; it holds.
- Generalise. Ask what happens for 1 to 100, or 1 to any number n. The same idea gives a formula: pair total times number of pairs, which is n × (n + 1) ÷ 2. You have just derived what a program would use.
Worked example
Practise on three sums. 1 to 10: five pairs of 11, so 5 × 11 = 55. 4 to 15: that is twelve numbers, six pairs of 19 (4+15), so 6 × 19 = 114. 1 to 99: ninety-nine numbers do not pair evenly, so take 99 × 100 ÷ 2 = 4950, or make 49 pairs of 100 and add the lonely middle number, 50. The pattern bends to fit; that is abstraction working.
Discussion
Ask: which of the four steps was the hard one? Almost always it is spotting the pattern. Once you see it, the algorithm writes itself, and that is the work a computer cannot do for you.
4. The Game with Conditions15 min
Play a fast classroom game where one rule decides everyone's move, and feel how if, else if and else work from the inside.
What it teaches
Conditions, the way a program chooses between actions. An if checks something and acts only when it is true. An else if offers a second test if the first one failed. An else is the catch-all that runs when nothing above matched. The computer checks them top to bottom and stops at the first that fits, which is exactly what your brain does in this game.
What you need
- A handful of everyday objects or picture cards: a bird, a paper plane, a book, a spoon, a leaf.
- A way to keep score, on paper or on the board, one line per student or team.
- Blank if / else if / else templates for the second half of the activity.
How to run it
- Write the rule where everyone can see it: if the object can fly, raise your hand for +5 points; else, stay perfectly still and keep the points you have. Reacting the wrong way costs you points.
- Hold up an object. Each student decides on their own and reacts at once. A bird or a paper plane means hands up; a book or a spoon means stay still.
- Score each round out loud so the rule stays concrete: hands up on a bird earns points, hands up on a spoon loses them, staying still on a bird loses them too.
- Add a middle branch to show else if: if it can fly, hands up (+5); else if it has wheels, stand up (+3); else, stay still. Now there are three possible reactions and only one is right per object.
- Hand out the blank templates and let students invent their own game. They fill in their own conditions and points, test it on the class, and fix any rule where two objects could both match.
Worked example
Write one round as a program and trace it for a toy car. if (it can fly) raise hand, +5; else if (it has wheels) stand up, +3; else stay still, +0. The car cannot fly, so the first line is skipped. It has wheels, so the else if runs: stand up, +3, and the else is never reached. Try the same trace for a paper plane and for a book and see which branch each one lands on.
Discussion
Ask: what happens if an object matches two conditions at once, say something that flies and has wheels? The computer takes only the first that fits and ignores the rest. Order changes the outcome, so programmers put the most important test first.
Developed by alphaPlan Center.