- :-

Topics Covered

  • Switch in Loop
  • Lesson Links

    Check Your Understanding:
    1. 1. What happens when you place a Switch inside a Loop?
    2. The robot runs in a circle until told to stop
      The robot makes a decision once, then repeats the result many times
      The robot makes a decision many times, taking whatever action is appropriate each time
      You cannot place a Switch inside a Loop
    3. 2. When a Switch is placed inside a Loop…
    4. Both the Switch and Loop operate normally, but the arrangement is useful
      The software interprets the Switch+Loop structure as a special construct
    Try It!
    Try it! 1

    Maze Runner

    The simple behavior you wrote in the video can be used as a very simple maze solver!

    Build a maze for the robot, made up of square floor tiles.

    If you don't have floor tiles, use 30 cm squares.
    Adjust your Forward movement to go one tile per movement, rather than 3 rotations.
    What happens?
    The robot will perform its move-or-turn behavior in each tile, eventually solving many simple maze configurations!