Register to receive free access to all teacher materials.
Make your Finch wander randomly and avoid obstacles.
Free Teacher Materials
ADVANCED: Going Further
Required lesson: Randomness
Program your Finch to wander around a room. The Finch should move forward until it finds an obstacle. When it encounters an obstacle, it should back up and turn away from it randomly for two seconds. You can do this by generating two negative random values for the left and right wheel velocities.
The Finch’s beak should glow green when it is moving forward. The beak should change to red when the Finch is moving away from an obstacle. Since Finches are diminutive and polite creatures, it should also beep apologetically when it sees an obstacle.