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

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:

  1. Bot on the start. Tester puts a finger on the first card.
  2. Bot does that card. Is it still OK? Move the finger to the next card.
  3. As soon as something goes wrong, say "Bug!" and keep the finger on that card.
  4. 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.

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)

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

Safety

Teacher notes