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.
Worked examples
Block
Start x
End x
move (60) steps
−100
−40
move (120) steps
−100
20
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.
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.
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?
move (100) steps. The sprite ends at x: 40 (−60 + 100 = 40).
2
The block is “say [Hi!] for (3) seconds”. Make the sprite say it twice as long. What is the new block?
say [Hi!] for (6) seconds.
3
This program takes 4 + 2 + 2 = 8 seconds. Change the numbers so that it takes half as long.
Halve every number: say Ready for 2 seconds, wait 1 second, say Go for 1 second. The new total is 4 seconds.
4
Why is it a good idea to change only one thing at a time?
Then you know which change made the difference. If you change many things, you cannot tell which one caused a mistake.