Print

Activity

SquirrelBot

Program the Finch to take evasive action!

Free Teacher Materials

Get Access

INTERMEDIATE: Add Sensors

Required lessons: Sensor Overview, Conditional Statements

    The SquirrelBot must stay alert for hungry birds of prey.  When he senses the dark shadow of a hawk above him, he needs to take evasive action to confuse the hungry bird. Program two escape maneuvers to allow your SquirrelBot to survive another day.

    The requirements for this project are as follows:

    • The Finch must detect when a shadow falls on either the left or right light sensors.
    • When there is no shadow, the Finch should be still.
    • When a shadow is detected, the Finch must make an escape maneuver.
    • The maneuver should be different depending on which sensor was shadowed.

    ADVANCED: Going Further

    Required lessons: Control Structures & Line Tracking, Randomness, Variables

      The SquirrelBot must stay alert for hungry birds of prey.  When he senses the dark shadow of a hawk above him, he needs to take random evasive action to confuse the hungry bird. Program four different escape maneuvers to allow your SquirrelBot to survive another day.

      The requirements for this project are as follows:

      • The Finch must detect when a shadow falls on either of the light sensors.
      • When there is no shadow, the Finch should be still.
      • When a shadow is detected, the Finch must make an escape maneuver.
      • The Finch should have at least four possible escape maneuvers.
      • Each time the Finch detects a shadow, it should randomly choose one of the possible escape maneuvers.

      Hint: Make a variable called escapePlan. Each time the Finch detects a shadow, set this variable equal to a random number between one and the number of escape maneuvers.