3
Plan, test and share
Computing 2: Unit 8, pp. 106–121
GoalPlan your own drawing for a robot, test it and share it kindly.
New words
plan · to work out what to do before you starttest · to run an algorithm to see if it workscredit · to say who made something
Explanation
A good robot artist plans first. Draw the shape on squared paper. Write the algorithm. Look for a pattern, because a repeat makes it shorter. Test it by tracing it, and then by walking it. Fix any bug. When you share your work, say who made it. Ask before you share a picture of somebody else’s drawing.
Worked examples
A flag shape. The robot starts at the bottom left, facing up. It goes up the pole, then right, down, and back along the flag. Algorithm: start, marker down, forward 4, turn right, forward 2, turn right, forward 1, turn right, forward 2, stop.
| Shape | Pattern? |
|---|---|
| flag | no repeat |
| square | repeat 4 times: forward 2, turn right |
| Test | How |
|---|---|
| 1 | trace it with a pencil |
| 2 | walk it yourself on the floor |
| 3 | compare with the picture |
| 4 | ask a friend to follow it |
Class activity
Robot artist: plan a drawing on squared paper using only straight lines and right-angle turns, such as a flag, a hook or a staircase. Write the algorithm. Count the steps. Trace it with a pencil. Then ask a friend to be the robot and walk it with chalk or tape. Fix any bug. At the end, write your name and your friend’s name on the picture as the makers.
Practice
1
Write the algorithm for this path. The robot starts at the top left, facing right.
Start, marker down, forward 2, turn right, forward 2, turn left, forward 2, stop.
2
Make this shorter with a repeat: forward 2, turn left, forward 2, turn left, forward 2, turn left, forward 2, turn left.
Repeat 4 times: forward 2, turn left.
3
Plan a drawing of your own: choose a number or a letter with straight lines. Write its algorithm.
Any shape with a start, marker down, moves and turns, and stop. Check it by tracing.
4
Name three ways to test an algorithm.
Any three, for example trace it with a pencil, walk it on the floor, compare it with the picture, or ask a friend to follow it.