3
Spin and say
Computing 2: Unit 1, pp. 8–23
GoalRead, write and check programs that move, spin and say something, and tell which algorithm is more precise.
New words
say · a block that shows a speech bubbletest · to run a program and check that the result is rightprecise · exact, clear and correct
Explanation
A program can do more than one thing. A character can spin and then say something. The blocks run from left to right, one after the other. Here a parrot makes a half turn and then says “Hello!”. Always test your program. Does the result match the algorithm? If not, there is a mistake to find and fix.
Worked examples
A rabbit spins once and then says “Ta-da!”. Spin right 12 is one whole turn, and the say block comes after it.
Spin left 12 is also a whole turn, but the other way round. The left and right blocks have arrows that curl in different directions.
Ella’s algorithm says “Spin”. The computer cannot know which way or how far. “Spin left 3” is precise: it says left, and 3 is a quarter turn.
Class activity
Test and fix: write this algorithm on a card for a friend: 1 Start. 2 Clap 2 times. 3 Spin left 3. 4 Say “Ready!”. 5 Stop. Your friend does each step in order. Then change just one step, for example spin left 6, and watch what is different. Which steps were easy to follow? Which needed a number to be precise? If you have a computer or tablet, build a program like it in ScratchJr with an adult.
Practice
1
Which program makes a character spin around two whole times?
B. Spin right 24 is two whole turns.
2
The algorithm says spin LEFT 12. Which block is wrong?
The red block. It turns right. It should be a turn left block.
3
Write the algorithm for this program.
1 Start on tap. 2 Say “Hi!”. 3 Spin left 6. 4 Stop.
4
An algorithm says: 1 Start on tap. 2 Move right 4. 3 Stop. It should also make the character say “Wow!” at the end of the move. Which step must be added, and where?
Add “Say Wow!” as a new step after Move right 4 and before Stop.