Giving Clear Step-by-Step Instructions to a Robot
Byte the robot stands in a bright kitchen beside a table with bread, butter, and a butter knife, holding up a numbered list on a glowing screen and grinning as a small lightbulb glows above its head
- Explain what an algorithm is using your own words
- Identify the correct order of steps to complete a simple task
- Predict which step order will give the right result
- Demonstrate that changing the order of steps can change the result
Key terms
- algorithm
- a set of steps done in order to finish a task
- instruction
- one clear step that tells exactly what to do
- order
- which step comes first, next, and last
- result
- what you end up with after the steps run
Why Robots Need Algorithms
A robot cannot think for itself or guess what you mean. It only does what its instructions tell it, exactly as written. That is why we give it an algorithm, which is a set of clear steps done in order. Each step must be plain enough that the robot cannot get confused. When you write an algorithm, you are doing the thinking ahead of time so the robot can simply follow along, one step after another, all the way to the finish.
Order Changes the Result
In an algorithm, the order of steps is just as important as the steps themselves. Putting on a sock then a shoe gives a comfy foot, but sliding into the shoe first leaves the sock stuck on the outside. The same four steps led to a very different result simply because the order changed. Before you finish an algorithm, ask what has to happen first and whether the next step could even work if you skipped this one.
Worked examples
Order these sandwich steps to make a real sandwich.
- Ask what comes first: you need bread to work on, so pick up two slices of bread.
- Ask what comes next: with bread ready, spread butter on one slice.
- Ask what comes last: press the two slices together to finish the sandwich.
Answer: 1) Pick up two slices of bread, 2) spread butter on one slice, 3) press the slices together.
Activity
Put Byte's sandwich-making steps in the right order to make a perfect sandwich
Practice
Write an algorithm with at least three steps for pouring a glass of water.
Tell what goes wrong if you tie the laces before sliding your foot into the shoe.
Common mistakes to avoid
- A robot makes up its own steps.A robot cannot think on its own; it only follows the exact steps in the algorithm you write.
- Order in an algorithm does not matter.The same steps in a different order can give a very different result, like a sock outside a shoe.
Check your understanding
What is an algorithm?
Byte wants to pour juice. But the juice box is still closed. What happens when Byte tries to pour?
Which of these is the BEST example of an algorithm?
Recap
An algorithm is a set of clear steps done in order to finish a task. A robot cannot think on its own, so it follows the algorithm exactly as written. The order of the steps matters a lot, because the same steps in a different order can give a completely different result.
Reflect
What everyday task could you write as an algorithm, and what is its first step?