Skip to main content

Lesson 5: Disk Maze Challenge

In this Disk Maze Challenge, the VR Robot will navigate the Disk Maze Playground from start to finish using the Front Eye Sensor. The VR Robot also must drive back to the starting position and begin the Disk Maze again, in order to solve the Disk Maze Challenge forever!

Top down view of the Disk Maze Playground. The VR robot is at the red disk, facing to the left. A black arrow indicates the path the robot will take to drive forward to the green starting location, then turn right and drive forward towards the first green disk.

Learning Outcome

  • Apply commands from the Drivetrain, Sensor, and Control categories to be able to solve the Disk Maze Challenge.

Putting It All Together

The if statement is found in the Control category. If the condition of the if statement reports True, then the VR Robot will perform a set of behaviors contained within the if statement. The behaviors inside of an if statement will be skipped if the condition of the if statement reports False.

To repeat the behaviors forever, the if statements must be contained within an infinite while loop.

Two python projects. On the left is a project with 4 if statements. A red x is above the project. On the right is the same project with the if statements inside of an infinite while loop. A green check is above the right project.

If statements are used inside of infinite while loops in order for each condition of the if statement to be checked repeatedly. During the flow of the project, if the condition of the if statement is True, the commands inside of the if statement are executed. If the condition of the if statement is False, the commands inside of the if statement are skipped, and the flow of the project will continue to the next command.

Using if statements inside of infinite while loops allows a VR Robot to respond accordingly to its environment, such as stopping or turning when a VR Robot detects an object of a certain color.

Side view of a VR robot on the Disk Maze Playground. The robot is at the green disk and in the process of turning right.

Select the Next button to continue with the rest of this Lesson.