5
Unit B · Telling a computer what to do
Instructions in order
What we are making: no computers at all this session. You are going to
program a person, and find out why it is harder than it sounds.
The idea
A computer does exactly what you say. Not what you meant. It never guesses, never fills in
the obvious bit, and never says "you probably meant left".
That is the single most important thing to understand this year, and the fastest way to
understand it is to be on the receiving end of bad instructions.
New words
AlgorithmA list of steps that solves a problem. A recipe is one.
SequenceThe order the steps happen in. Change the order, change the result.
BugA mistake in your instructions. Named after a real moth, in 1947.
DebugFinding the mistake and fixing it. Most of programming is this.
Do it — the sandwich
Your teacher has bread, and something to put on it. One of you writes instructions. Your
teacher follows them exactly.
- In your team, write down how to make the sandwich. Numbered steps.
- Hand it over. Say nothing while it is read.
- Watch. Your teacher will follow what you wrote, not what you meant.
- Write down every place it went wrong.
- Fix your instructions. Try again.
💡 Tip
Nearly every team forgets to say open the bag. That is not you being careless. It is that your brain fills in obvious steps automatically, and a computer's does not.
Do it — the robot walk
In pairs, in the corridor or an open space. One person is the robot, one is the programmer.
The robot's eyes are closed.
- The robot understands exactly four instructions: forward one step, turn left, turn right, stop.
- The robot does nothing else. No interpreting, no avoiding furniture, no helping.
- The programmer writes the whole list before the robot starts moving. No shouting corrections.
- Pick a target across the room — a chair, a door.
- Write the full list of instructions.
- Run it. Do not speak once it has started.
- Note where it actually ended up.
- Swap roles and do it again.
⚠ Careful
Writing all the instructions in advance is the part that feels unnatural, and it is the part that is really programming. Steering as you go is not.
Try it — order matters
These four steps are all correct. In this order they do not work. Rewrite them so they do.
Four right steps, wrong order
pour the milk
drink it
get a glass
put the glass down
What you learned
- A computer does what you say, not what you mean.
- Your brain hides the obvious steps. Write them down anyway.
- Order changes everything.
- A bug is a mistake in your instructions, not a disaster.
- Debugging is normal. It is most of the job.
Challenge optional — only if you finish early- Write instructions for making a sandwich so exact that somebody could follow them wrongly on purpose and still end up with a sandwich.