Exact Instructions
A computer does what you said, not what you meant. Write steps so clear that a robot could follow them without guessing.
- Write a short plan as numbered steps
- Use words like forward and turn left that mean one action each
- Find the step that sent a robot the wrong way
Finish first
Topic contents
Lesson 1 of 3
Say exactly what to do
Try telling a friend to make a jam sandwich using only short steps. If you say 'put jam on bread', they might put the jar on top of the loaf. You meant open the jar, spread jam on a slice, but you left that out. A computer has the same problem: it does not fill in gaps.
Good steps are small and unambiguous. 'Forward' means move one square. 'Turn left' means rotate without moving. Each step should do one thing. If you need two things, write two steps.
Open the robot lab beside this lesson and run the Straight line plan. Three forwards, no turns. The robot reaches the flag because every step meant one move.
Robot planner
Pick a plan, press play, and watch the robot follow each step. When it bumps, find which step was wrong.
Robot planner
Sequences, turns, repeats and choices- Forward
- Forward
- Forward
Start
The robot starts here, facing right. The plan has 3 steps. It will follow them exactly, even when that is wrong.
Lesson 2 of 3
When the plan fails
Run the Find the bug plan in the lab. The robot walks into a wall on the last forward. Nothing is wrong with the robot. Step four told it to move when there was no space.
Debugging is the word for finding that wrong step. You read the plan from the start and ask: after each step, where should the robot be? The first step that does not match reality is the bug.
Try the Turn first plan too. Sometimes you need a turn before a forward. If you only write forwards, the robot never faces the flag.
Lesson 3 of 3
From robot to program
The robot grid is a toy version of what programs do. Later you will write commands in a language, but the idea stays: a list of instructions, run in order, with no guessing.
Good coders still draw plans on paper before they type. The plan can be boxes and arrows, or a numbered list like the robot lab. The paper version is cheaper to fix than code.
Before you leave this topic, write five steps for brushing your teeth so someone who has never seen a toothbrush could follow them. Count how many details you almost skipped.
Practice
Work these out yourself
No answer key here on purpose: these are the questions worth thinking through before you move on. Open one and work it out.
0/3 attemptedAssessment
Check your understanding
Answer each question, then read the explanation. That is where the learning is.
Finished this topic?
0 of 3 lessons marked done. Marking the topic complete ticks the rest.
