Skip to content

Making Choices

Sometimes the next step depends on what you see. If there is a marker, turn left; otherwise go forward. That is a choice.

Class 3 to 5beginner20 min3 lessons1 interactive lab
By the end you will be able to
  • Write a rule that picks between two actions
  • Explain why the robot must check something before it chooses
  • Connect everyday if-then decisions to programs

Finish first

Lesson 1 of 3

If this, then that

You already make choices all day. If it is raining, take an umbrella. Otherwise walk normally. The second part only runs when the first part is true.

In the robot lab, the Choose a path plan says: walk to the yellow marker, turn left, then walk to the flag. The marker is how the plan knows which way to choose.

Without a check, the robot would always turn or always go forward. Choices need a question first: what do I see?

Interactive lab

Robot planner

Run Choose a path and watch the robot turn at the marker to reach the flag.

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

Two paths, one plan

Run Choose a path slowly. The robot moves up onto the marker, turns left, then reaches the flag. Going straight instead would hit the wall beyond the marker.

Games use this constantly. If the player touches lava, reset the level. If the score passes 100, show a win screen. Same shape as the robot: check, then pick.

Write your own rule: 'If the light is red, stop; otherwise walk.' That is an algorithm you already follow.

Continue

Lesson 3 of 3

Choices plus repeats

Big programs combine ideas. A loop might repeat until a goal is reached, and inside each repeat an if-then picks left or right. The robot lab keeps them separate so you can learn one at a time.

When a plan fails, ask: was the wrong branch chosen, or was the check looking at the wrong thing? Fixing choices means fixing the question, not only the action.

Next you will order things without a robot: compare two cards and swap when they are backwards.

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: What must happen before a choice in a plan?
    Question 1 / 4

    What must happen before a choice in a plan?

    Select an option first
  2. Question 2: If it is raining, take an umbrella. Otherwise go outside. Which runs on a sunny day?
    Question 2 / 4

    If it is raining, take an umbrella. Otherwise go outside. Which runs on a sunny day?

    Select an option first
  3. Question 3: In the fork plan, what does the marker tell the robot?
    Question 3 / 4

    In the fork plan, what does the marker tell the robot?

    Select an option first
  4. Question 4: Why do games use if-then rules?
    Question 4 / 4

    Why do games use if-then rules?

    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.