AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Fix the story

Week 26 · Unit 10: Be a storyteller · 3 lessons
2

Two bugs at once

Computing 2: Unit 10, pp. 134–148
GoalFind the clues that show different kinds of bugs in a story with two characters.
New words
clue · a small sign that helps you find the answerreplay · to run the program againchecklist · a list of things to tick off
Explanation

A story can have two characters and two bugs. Look for clues. If a character never starts, the start block or the message colour may be wrong. If it goes too far, a number may be wrong. If things happen in the wrong order, the blocks may be in the wrong places. Fix one bug, then replay the story. Tick each bug on your checklist.

ClueLikely bug
a character never startswrong start block or message colour
a character goes too farwrong number
things happen in the wrong orderblocks in the wrong places
Worked examples
BugWhereFix
1rabbit: hop 5change to hop 2
2fox: say before moveput the move block first
The rabbit’s algorithm: start on green flag, hop 2, say “Run!”, send a yellow message, stop. The fox’s algorithm: start on yellow message, move left 3, say “Wait!”, stop. In the program, the rabbit hops 5, and the fox speaks before it moves. These are two bugs.
Wait!3start onmessagesaymoveleftend
The red outline shows the fox’s say block. It comes before the move block, but the algorithm says move first. We drag the say block after the move block.
BugFixed?
rabbit hops too highyes
fox speaks too soonnot yet
A checklist helps us keep track. We tick each bug when it is fixed. When every bug is ticked, we replay the whole story.
Class activity

Bug stickers (pairs): make a story program on paper with two characters and four blocks each. Draw a small paper dot on two blocks where you changed a number or a colour on purpose. Do not show your friend. Your friend reads the story aloud, compares it with your algorithm, and writes a checklist of the bugs. Then lift the dots and see if they found both.

Practice
1
The bus should drive right 5 and stop at the bus stop. When you run the story, it drives right off the edge of the page. What kind of bug could it be? How do you find it?
2
A character should hop 2, but it hops 4. What kind of bug is this and how do you fix it?
4
3
The algorithm is: start on green flag, move right 2, say “Hi!”, stop. Look at the program. How many bugs are there?
Hi!3
4
Write a checklist for a story that has two bugs: the owl hops too high, and the mouse starts too soon.