AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Follow and fix steps

Week 1 · Unit 1: Making programs clear · 3 lessons
2

Find the wrong step

Computing 3: Unit 1, pp. 8–27
GoalFind the step that makes an algorithm go wrong and edit it so the algorithm works.
New words
edit · to change something so that it is better or correctcorrect · to fix a mistakecheck · to follow an algorithm and see if it does what we wanted
Explanation

Sometimes we follow an algorithm and it does not do what we wanted. It has a mistake. First, follow it and notice where you end up. Then compare that with where you wanted to be. Look at each step. Which step sent you the wrong way, or too far? Change only that step. Then follow the algorithm again to test it. Keep editing and testing until it works.

Worked examples
flower
The robot must reach the flower. The algorithm is: 1 Move 3 squares right. 2 Move 3 squares up. It ends at the top, one square too far. Step 2 is wrong. We edit it to “Move 2 squares up”. Now the robot stops on the flower.
StepInstruction
1Press 3
2Press −
3Press 4
4Press =
This algorithm should make a calculator show 7. Step 2 presses −, so the calculator works out 3 − 4 and the answer is wrong. We edit step 2 to “Press +”. Now it shows 3 + 4 = 7. The other steps are right, so we leave them alone.
tent
The robot must reach the tent. The algorithm says: 1 Move 2 squares up. 2 Move 2 squares left. After step 1 the robot is at the left edge, so moving left would take it off the grid. The direction in step 2 is wrong. It should say “right”.
Class activity

Be the bug hunter (with an adult): the adult writes a five-step algorithm to get from your bedroom door to a chair in the house, but secretly puts in one wrong number or direction. Follow it with your feet, one step at a time. When you end up in the wrong place, say which step is wrong and how to edit it. Then swap and make a mistake for the adult to find.

Practice
1
The robot should reach the star. The algorithm is: 1 Move 4 squares right. 2 Move 1 square up. Where does the robot end up, and which step is wrong? How do you edit it?
star
2
This algorithm should write the word “sun”. Which steps are wrong? Write the correct algorithm.
StepInstruction
1Write s
2Write n
3Write u
3
The robot starts in the top-left corner and must reach the tree. The algorithm is: 1 Move 2 squares right. 2 Move 2 squares up. Which step is wrong, and why?
tree
4
Rosa’s algorithm does not work, so she changes every step. Is that a good plan?