Counting Disks
Use [Drive] and [Turn for] blocks, and the Down Eye Sensor to navigate the VR Robot to move through the Disk Maze from the Start Position (the green square) to the Finish Position (the red Disk). Create an algorithm to count the number of green Disks and the number of blue Disks on the Playground.
- Select the Disk Maze Playground.
- Code the VR Robot to drive from the Start Position (the green square) to the Finish Position (the red Disk).
- Use variables to store the number of green Disks and the number of blue Disks.
- Use the Down Eye Sensor to detect the floor colors. Code the VR Robot to perform diverse behaviors based on the detected color.
- Use the [ Forever] block to keep the VR Robot constantly moving in the maze and keep the Down Eye Sensor constantly checking for certain colors to count the Disks and stop at the Finish Position.
- Print the variable values to the Print Console to report the number of green Disks and the number of blue Disks.
Helpful Hints
- For help with storing data in the project, please select the “TUTORIALS” button in VEXcode VR and choose the Storing Data Tutorial.

- For more information about the name rules for variables in VEXcode VR, please see this article.
Use the set block from the Variables category to set the value of the variable.

Matching Python command:
Green = 0
Use the if then else if then else block from the Control category to code the VR Robot to perform diverse behaviors based on the Down Eye Sensor conditions. The if then else if then else block runs the blocks based on the values of the Boolean conditions reported. You can add or remove conditions.

Matching Python command:
if condition: pass elif condition: pass else: pass
Use the print block from the Look category to print the values to the Print Console.

Matching Python command:
brain.screen.print("VEXcode")