Lesson 3: Keeping score at the Little Hill fair

Unit overview - Previous: Lesson 2 - Next: Lesson 4

About 45 minutes.

Goal

Children run a game program that uses events and a score variable. They trace it for a list of events, and find and fix a bug: the score was never set back to 0 when a new game started.

Materials

Steps

Opening (5 min)

  1. Say: "The made-up town of Little Hill is having a school fair. One stall has a hoop-toss game. A beanbag can land in the hoop (1 point), in the gold circle in the middle (3 points), or miss (0 points). The stall wants a program to keep the score."
  2. Say: "Nobody throws anything today. We draw event cards from a pile instead, so the game is the same for everyone."

Main activity (30 min)

Part 1: the program (8 min). Put up:

WHEN GAME STARTS:
    SET score TO 0

WHEN IN HOOP:
    CHANGE score BY 1

WHEN GOLD:
    CHANGE score BY 3

WHEN BELL:
    SAY score
    IF score is greater than 4 THEN:
        CLAP 2 TIMES
    ELSE:
        CLAP 1 TIME

Ask: "Which event has no script?" (MISS. Nothing happens, so the score stays the same.) Trace List 1 together on the board:

Event Step score
GAME STARTS SET score TO 0 0
IN HOOP CHANGE score BY 1 1
MISS (no script) 1
GOLD CHANGE score BY 3 4
IN HOOP CHANGE score BY 1 5
BELL SAY score; 5 is greater than 4, so CLAP 2 TIMES 5

Part 2: groups run fixed lists, then a random game (12 min). Roles rotate: event giver, box keeper, tracer, checker. Groups run:

Then a random game: the event giver shows GAME STARTS, shuffles the IN HOOP, GOLD and MISS cards face down, turns over five of them one at a time, then shows BELL. The tracer writes each step. (The biggest possible score is 13: four GOLD and one IN HOOP. Any total is fine; the check is that the trace matches the cards.)

Part 3: a bug (10 min). Show the program again with the WHEN GAME STARTS script missing. Say: "The stall used this version. The first game was List 1 and ended on 5. Then a new child played: IN HOOP, then BELL." Groups run it with the box still holding 5. (5 + 1 = 6; it says 6.) Ask: "What should it have said?" (1.) "Which line is missing?" (SET score TO 0, under WHEN GAME STARTS.) Put the script back and run the new game again: GAME STARTS, IN HOOP, BELL. (0, 1; says 1; clap 1 time.)

Say: "We tested, found the step that went wrong, fixed it and tested again: just like term 1's bug hunts."

Discussion questions (with answers) (5 min)

Closing check (with answers) (5 min)

  1. "GAME STARTS, GOLD, MISS, IN HOOP, IN HOOP, BELL. What is said, and how many claps?" (3, 3, 4, 5; says 5; clap 2 times.)
  2. "With the start script missing, the box holds 5. Then GOLD, BELL. What is said, and what should it be?" (8; it should be 3.)
  3. "Which line fixes it?" (SET score TO 0 when the game starts.)

Vocabulary

event, variable, score, bug, test, reset (set back to 0)

Differentiation

Safety

Teacher notes and misconceptions