Lesson 4: Plan before you run
Unit overview - Previous: Lesson 3: Break it down - Next: Lesson 5: Plan, code, swap and check
Back to the grade 2 year plan
Goal: Children fill in a plan (goal, start, steps, what should happen) before running a floor-grid program, then run it and compare what happened with the plan.
Length: about 30 minutes.
Materials
- The 4 by 4 floor grid with the marked front edge, start card, a "Hen's house" card and a toy letter (folded paper), from the grade 1 robot unit.
- Arrow cards (forward, turn left, turn right) and a program strip per group of three.
- Job badges: programmer, tester, bot (one set per group).
- Planning sheets, one per group: boxes for Goal, Start, Steps and What should happen, and a box with a tick and a cross for Did it happen?
- A large planning sheet on the board.
- Table grids (4 by 4 on paper) with a toy or counter, for groups not on the floor grid.
- Optional, for blind or low-vision children: tactile arrow cards, a raised-edge table grid and planning-sheet boxes with symbol cards.
- Ear defenders and a quiet spot.
Steps
Opening (5 min)
"Duck has a letter for Hen. Before the robot moves, programmers make a plan." Fill in the large planning sheet with the class:
- Goal: take the letter to Hen's house.
- Start: column 1, row 1, facing the back of the grid (show the start card and point).
- Steps: (left empty for now).
- What should happen: "The robot stops on Hen's house holding the letter."
"Writing what should happen before we run the program means we can check it afterwards."
Main activity (17 min)
- A plan with a bug (5 min). Put the start card on (column 1, row 1) and Hen's house on (column 3, row 3). Write these steps on the board plan: forward, forward, turn left, forward, forward. A volunteer bot holds the letter and the tester shows each card. Stop the bot as soon as a step would take it off the grid. "Did it happen?" (Answer: no. After forward, forward the bot is on (column 1, row 3). Turn left points it off the left edge, so the next forward leaves the grid.) "Which step is different from our plan?" (Turn left.) Change it to turn right and run again. (Answer: forward, forward, turn right, forward, forward ends on (column 3, row 3), Hen's house. Tick "Did it happen?")
-
Groups plan and run (10 min). Groups of three. Start card on (column 4, row 1), bot facing the back; Hen's house on (column 2, row 4). The group fills in Goal, Start and What should happen first, then lays out the steps, then runs. The tester ticks or crosses "Did it happen?". If it is a cross, they find the first step that went wrong, fix it and run again. Swap badges after each run.
(One answer: forward, forward, forward, turn left, forward, forward. Other answers that reach Hen's house also count, for example turn left, forward, forward, turn right, forward, forward, forward.)
3. Share (2 min). One group shows its plan and says whether it matched.
Discussion questions (with answers) (4 min)
- "Why do we write 'what should happen' before we run the program?" (So we can check if the program did what we wanted, and spot a bug.)
- "Two groups had different steps but both reached Hen's house. Were both right?" (Yes. Different programs can reach the same goal.)
- "What do we do if 'Did it happen?' is a cross?" (Find the first step that went wrong, fix it and run again.)
Closing check (with answers) (4 min)
On the board: Goal "reach the star". Start (column 2, row 1), facing the back. Steps: forward, forward. What should happen: "stops on (column 2, row 3)". Show the star on (column 2, row 3). Children show tick or cross for "Will it happen?" (Answer: tick. Two forwards from row 1 reach row 3.)
Vocabulary
- plan: what we write before we start: the goal, the steps and what should happen.
- goal: what the program is for.
- bug: a step that makes the program do something we didn't plan.
Differentiation
- More support: routes with no turns (Hen's house straight ahead), and a planning sheet with only Goal and What should happen.
- More challenge: add a "puddle" card the robot must not step on, for example on (column 4, row 3) in the group route, and plan a route around it. (One answer: forward, turn left, forward, turn right, forward, forward, turn left, forward. It goes round the puddle and ends on (column 2, row 4).)
Safety
- The bot walks slowly, one square per card, and nobody else stands on the grid during a run.
- Being the bot is never required; a toy on a table grid counts.
Teacher notes
- "Column" and "row" names are for the adult. Children use the start card, the Hen's house card and pointing.
- A common error is turning and stepping on a turn card. Remind children that turn cards turn on the spot with no step, as in grade 1.
- Right and left are from the robot's view. If the bot faces the front edge, the cards look reversed to the class; the "stand behind the robot" trick from grade 1 helps.
- Duck, Hen and the routes are the author's own examples; every route was checked with a small script.