Fix the Plan
When the robot bumps a wall, the machine was not naughty. One step in the plan was wrong. Learn to find it calmly.
- Say that a bug is a wrong step, not a broken machine
- Read a plan from the start when something fails
- Change one step and test again instead of guessing
Finish first
Topic contents
Lesson 1 of 3
The robot did what you wrote
If the robot walks into a wall, your first feeling might be that the robot is silly. It is not. It followed the list exactly. The list had a mistake. That mistake is called a bug.
Good debuggers read from step one. Did forward mean one square? Did turn left happen before the next forward? One wrong word early can send the robot the wrong way later.
Open the robot lab with the Wrong turn plan. Step through until the bump. Pause on the step that sent the robot facing the wall.
Robot grid
Build a plan and step through it. When the robot bumps, find which instruction aimed 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
Change one thing, try again
Change many steps at once and you will not know which fix worked. Change one step, run the plan again, and watch. That is how real programmers work too.
Sometimes the fix is adding a step you forgot, like turn left before forward. Sometimes it is removing an extra turn. Write the new plan on paper first if the lab feels fast.
Watch the step-flow animation. See a plan fail, one line change, then success on the second run.
Lesson 3 of 3
Bugs happen to everyone
Finding bugs is normal work, not a sign you failed. Games, apps and satellites all ship with bugs that testers find later.
Ask a friend to read your plan aloud while you act it out. Fresh eyes spot missing steps quickly.
Next you will learn loops so you do not repeat the same mistake four times in a row.
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.
