3
Robot delivery project
Computing 1: Topic 1.4, pp. 49–59
GoalPlan, write, test and fix a code to take a letter to a house.
New words
project · a bigger job with many stepstest · run it to see if it works
Explanation
Draw a small town on a grid. Pick a house for a letter. Plan a route to it. Write the code on cards. Test it. Does the robot reach the house? If not, find the bug, fix it and test again.
Worked examples
Plan: the letter goes to the house. The robot starts at the bottom left, facing up. Code: X F F R F F F GO.
Test: Amir writes X F R F F F GO for the same house. The robot ends one square too low. The letter does not arrive. The bug: one F is missing before the turn.
Fix and test again: Amir adds an F before the turn. Now the code is X F F R F F F GO. The letter arrives!
Class activity
Paper town: draw a grid of nine big squares on paper. Draw a few houses, a shop and a park. Choose a start square. Write a code to take a toy car to one house. A family member moves the car, one card at a time. Did it arrive? If not, find the bug together. Fix it and test again.
Practice
1
The start is the bottom left, facing up. Write the code to reach the school.
X F F F R F F F GO.
2
A partner’s code is X F F R F GO for the same school. Where does the robot stop? What is the bug?
It goes up two, turns right and goes one square, so it misses the school. It needs one more F before the turn and two more F cards after it: X F F F R F F F GO.
3
What do you do after you fix the code?
Test it again.
4
Why is it good to ask someone else to test your code?
They may find bugs that we missed.