Following and creating step-by-step instructions (algorithms without a computer)
Machine translation
Learn
An algorithm is a list of steps to achieve something. The steps go in order. Each step is an instruction. We use them every day: to wash our hands, make bread or go to school.
1. Turn on the tap 2. Wet your hands 3. Put on soap 4. Rub your hands 5. Rinse with water
An algorithm for washing your hands The order matters. You cannot rinse off the soap before you put it on. If you change the order, the algorithm may fail. A good algorithm always gives the same answer if you repeat it.
Each instruction has to be clear. You must be able to do it without hesitating. A robot does not guess. It only does what the instructions say.
“Move forward a bit” not clear “Move forward 2 squares” yes, that's clear
How much is a bit? With 2 squares there is no doubt To move a robot around a grid we use arrows. Each arrow moves the robot one square. The robot starts on square S and wants to get to square M.
The algorithm → → ↑ ↑ takes the robot from S to M There can be more than one algorithm for the same thing. That is why you have to test them. Follow them with your finger, step by step. If they fail, fix them.
To go back, reverse the route. Start with the last arrow and put the opposite one.
There: → → ↑ ↑ Back: ↓ ↓ ← ←
To go back, turn the arrows round and change their order
Worked examples
Example 1
Gus gets dressed. He has three steps: put on his shoes, put on his socks and tie his laces. In what order does he do them?
A. Put on your shoes B. Put on your socks C. Tie your laces
- Think about what has to happen first: socks go on before shoes.
- Then you put on your shoes.
- Finally, you tie your laces.
The order is: socks, shoes and laces.
Watch out! Here many people put on their shoes before their socks.
Example 2
Julie writes an algorithm for the robot. It has to take it from S to M: 2 squares to the right and 2 up. Which arrows does she write?
- Count the squares to M: 2 to the right and 2 up.
- Write one arrow for each square: → → ↑ ↑.
- Follow them with your finger to check.
She writes → → ↑ ↑.
Watch out! Here many people write just → ↑: one arrow for each direction, and not one for each square.
Example 3
Tony says to Julie, who is pretending to be a robot: “Move forward a bit”. What should he say so that she does not hesitate?
No: “Move forward a bit” Yes: “Move forward 2 squares to the right”
- “A bit” does not say how much.
- Tony has to say how many squares and in which direction.
- For example: “Move forward 2 squares to the right”.
He should say: “Move forward 2 squares to the right”.
Watch out! Here many people think the robot understands what you mean.
A challenge to think about
Play with someone. Write arrows on a piece of paper to take them from the door to the table, one arrow for each step. They act as the robot and only do what the paper says. Do they get there? If they do not get there, fix the arrows.
Practise
Rounds of 10 questions. Choose a level:
Your grade in this topic:No grade yetDo a round at the Basic level to get a grade.