Create a maze with at least two turns, then use a variety of techniques to solve the maze. At the beginner level, you can mark a maze on the ground with masking tape. For the intermediate and advanced activities, use cardboard to build maze walls for the distance sensor to detect.
Thanks to Tamar McPherson from Plum Senior High School for this fantastic Finch maze video!
BEGINNER: Outputs Only
Required Lessons: Moving and Turning
Program a navigation sequence using only move and turn blocks. Iterate until your robot can get from start to finish without running into any walls.
INTERMEDIATE: Add Sensors
Required Lessons: Sensor Overview, Conditional Statements
A simple, but slow, way to escape a maze is to stay near one wall. Create a Finch wall follower:
- If the Finch does not detect a wall, the Finch should arc right so that it is both moving forward and turning.
- If the Finch detects a wall, it should back up, and then turn left 90 degrees.
ADVANCED: Going Further
Required lessons: Control Structures & Line Tracking, Variables, Lists
Program your Finch to solve a maze automatically! The Finch should:
- Move forward until it finds an obstacle.
- Turn right or left by 90 degrees if an obstacle is detected.
- If, after it has completed its first turn, it still sees an obstacle, then the Finch should turn 180 degrees. If it does not see an obstacle, it should move forward.
- Stop automatically at the end of the maze. Use a black line to indicate the end of the maze and detect the line with the line sensors.
Once your maze solver is working, rewrite it so that the Finch can determine how far it had to travel to solve the maze:
- Each time the Finch moves forward, it should reset the encoders, measure the distance it moves in centimeters, and add it to a list named distanceList.
- When you press button A, the program should move through distanceList and add each measurement to a variable called distanceSum. Then the program should display distanceSum (the total distance traveled) to the user.
Use cardboard and other craft supplies to make a physical maze.
- For a fun back to school activity, challenge students to model their maze after the school building. Have them program the Finch to move through their daily or weekly schedule. Students can attempt completing each other’s mazes, and even add challenges.
- Coding doesn’t have to be done in English! Challenge World Language students to build their maze and write their code in another language. Thank you to Laura Fleischer Proaño from the Highlands School District for the suggestion!