Lesson 3: Find the first wrong card
Unit overview - Previous: Lesson 2: Which way is the robot facing? - Next: Lesson 4: Round the rocks
Goal: Children test a program one card at a time, find the first card that goes wrong (a bug), fix just that, and test again from the start.
Length: about 30 minutes.
Materials
- The 4 by 4 floor grid with the marked front edge.
- Start card and star card.
- One arrow card set per group of three and one program strip per group.
- Job badges: programmer, tester, bot.
- Table grids with a toy robot.
- Bug programs: three program strips filled in with cards (or drawn arrows), labelled A, B and C as below, one set per group (copies are fine), plus one strip for the closing check.
- Ear defenders and a quiet spot.
- Optional, for blind or low-vision children: tactile arrow cards and a raised-edge table grid.
Steps
Opening (5 min)
"A bug is a mistake in a program. Every programmer gets bugs. The tester's job is to find the first card where things go wrong."
Show the tester's way to test:
- Bot on the start. Tester puts a finger on the first card.
- Bot does that card. Is it still OK? Move the finger to the next card.
- As soon as something goes wrong, say "Bug!" and keep the finger on that card.
- Programmer fixes one card. Bot goes back to the start. Test the whole program again.
Main activity (17 min)
All three bug programs are for the same route: start (column 1, row 1), bot facing the back; star (column 3, row 3). The right program is forward, forward, turn right, forward, forward. Do not show the right program; groups find it by fixing.
- Bug A (a step is missing): forward, turn right, forward, forward.
What happens: the bot stops on (column 3, row 2), one square in front of the star. The first wrong card is the turn right: it comes one forward too early. Fix: put one more forward card before the turn.
- Bug B (an extra step): forward, forward, forward, turn right, forward, forward.
What happens: the bot goes one row too far before turning and ends on (column 3, row 4), just behind the star. The first wrong card is the third forward card. Fix: take it out.
- Bug C (a wrong turn): forward, forward, turn left, forward, forward.
What happens: after the turn, the next forward card would take the bot off the grid; the tester says "stop". The first wrong card is the turn left. Fix: swap it for turn right.
Groups test A, B and C in any order, fix, and retest from the start each time. Swap badges between bugs. Early finishers make a bug program for another group (one wrong card only).
Discussion questions (with answers) (4 min)
- "Why do we go back to the start after a fix?" (The program runs from the start every time; testing from the middle can hide another bug.)
- "In bug A, no card was wrong on its own. What was wrong?" (A card was missing: the program needed one more forward before the turn.)
- "Is finding a bug a bad thing?" (No. Finding bugs is part of programming; that is what testers are for.)
Closing check (with answers) (4 min)
Toy robot on (column 1, row 1) facing the back; star on (column 3, row 3). Show the program: forward, turn right, forward, forward. Ask: "Where will it stop?" Children point. Then: "What card is missing, and where does it go?"
Answer: it stops on (column 3, row 2). One more forward card is needed before the turn right.
Vocabulary
bug, test, debug (find and fix a bug), first, missing, extra.
Differentiation
- Support: the child works with a partner on a table grid and moves the toy one card at a time, touching each card as they go.
- Stretch: the child says what kind of bug it is: missing, extra or wrong turn.
Safety
- The tester says "stop" before a forward card would take the bot off the grid.
Teacher notes
- Bug A is the hardest, because the first card that goes wrong is a correct card in the wrong place. Accept "the turn is too early" or "we need another forward" as right.
- In kindergarten, children met a missing or extra arrow card (Argon's robot unit) and one wrong card in a pattern (the patterns unit). This lesson puts all three kinds together on one route.