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 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!

A top-down view of the VR Disk Maze Playground, with the VR Robot having reached the final red disk and now turning to drive back to the starting goal. An arrow indicates the path that it should take to begin repeating the Disk Maze again.

Learning Outcome

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

Putting It All Together

The [If then] block is a C block from the Control category. If the condition of the [If then] block reports TRUE, then the VR Robot will perform a set of behaviors contained within the [If then] block. The behaviors inside of [If then] block will be skipped if the condition of the [If then] block reports FALSE.

The [Forever] block is a C block from the Control category that repeats the behaviors contained inside of it, forever.

A diagram analyzing the flow of logic of our VEXcode VR blocks project with a surrounding forever block included. The diagram indicates that the if statements repeat forever, and each one is checked each loop. Our project checks if the front eye detects green, and if so it turns right for 90 degrees. Next, if the front eye detects blue it turns left for 90 degrees. Next, if the front eye detects red it stops driving. Lastly, if the front eye detects none it drives forwards.

[If then] blocks are used inside of [Forever] blocks in order for each condition of the [If then] blocks to be checked repeatedly. During the flow of the project, if the condition of the [If then] block is TRUE, the blocks inside of the [If then] block are executed. If the condition of the [If then] block is FALSE, the blocks inside of the [If then] block are skipped, and the flow of the project will continue to the next block in the stack.

Using [If then] blocks inside of [Forever] blocks 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.

The VR Robot turning right after reaching a green disk in the Disk Maze Playground.

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