Skip to content

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.

Class 3 to 5beginner18 min3 lessons1 interactive lab
By the end you will be able to
  • 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

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.

Interactive lab

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
The plan
  1. Forward
  2. Forward
  3. Forward
1 / 4

Start

The robot starts here, facing right. The plan has 3 steps. It will follow them exactly, even when that is wrong.

Continue

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.

Continue

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.

Continue

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 attempted

Assessment

Check your understanding

Answer each question, then read the explanation. That is where the learning is.

0/4
  1. Question 1: A bug in a plan means what?
    Question 1 / 4

    A bug in a plan means what?

    Select an option first
  2. Question 2: When the robot bumps a wall, a good first move is what?
    Question 2 / 4

    When the robot bumps a wall, a good first move is what?

    Select an option first
  3. Question 3: Why fix one step at a time?
    Question 3 / 4

    Why fix one step at a time?

    Select an option first
  4. Question 4: A friend reads your plan while you move. This helps because what?
    Question 4 / 4

    A friend reads your plan while you move. This helps because what?

    Select an option first
4 of 4 questions left.

Finished this topic?

0 of 3 lessons marked done. Marking the topic complete ticks the rest.