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

Change the story

Week 15 · Unit 6: Be a storyteller · 3 lessons
1

Change a number, change the story

Computing 3: Unit 6, pp. 93–104
GoalChange numbers in blocks to get a different result, and predict what will happen first.
New words
change · to edit a block, for example by typing a new number in itpredict · to say what you think will happen before you run the programtwice as long · two times the time, so 3 seconds becomes 6 seconds
Explanation

We can change a program without building a new one. Often we only change a number. If “move (40) steps” becomes “move (80) steps”, the sprite goes twice as far. If “wait (4) seconds” becomes “wait (2) seconds”, the wait is half as long, so the story moves faster. Before you run the program, predict what will happen. Then run it and compare. If the result is different, look for a mistake. Change one thing at a time, so you know which change made the difference.

Beforewhenclickedmove40stepssayDone!for2secondsAfterwhenclickedmove80stepssayDone!for4seconds
Worked examples
BlockStart xEnd x
move (60) steps−100−40
move (120) steps−10020
A turtle starts at x: −100 and faces right. With “move (60) steps” it ends at x: −40. When the number is changed to 120, it ends at x: 20. The number of steps doubled, so the turtle moved twice as far.
6 secondswhenclickedsayRibbit!for2secondswait4seconds3 secondswhenclickedsayRibbit!for1secondswait2seconds
A frog says “Ribbit!” and then waits. The first program takes 2 + 4 = 6 seconds. We want half the time, so we halve both numbers. The new program takes 1 + 2 = 3 seconds.
Quickwhenclickednext costumewait1secondsnext costumewait1secondsnext costumeSlowwhenclickednext costumewait2secondsnext costumewait2secondsnext costume
A flower opens in three steps. We want it to open twice as slowly, so every wait must change from 1 to 2. Changing only one wait would not make it twice as slow.
Class activity

Be the sprite (with a friend): one of you reads the program card and the other is the sprite. The card says: “take 3 steps, wait 2 seconds, turn around”. Predict how long it takes (the turn is quick). Do it with a stopwatch or by counting “one thousand one, one thousand two”. Now change the card to “take 6 steps, wait 1 second, turn around”. Was your prediction right? Try other changes, but change only one number at a time.

Practice
1
A sprite starts at x: −60 and faces right. The block is “move (50) steps”. Change it so the sprite goes twice as far. What is the new block, and where does the sprite end?
whenclickedmove50steps
2
The block is “say [Hi!] for (3) seconds”. Make the sprite say it twice as long. What is the new block?
3
This program takes 4 + 2 + 2 = 8 seconds. Change the numbers so that it takes half as long.
whenclickedsayReadyfor4secondswait2secondssayGo!for2seconds
4
Why is it a good idea to change only one thing at a time?