Skip to main content

Color Line Passcode

Challenge: The Color Line Passcode consists of four numbers, each representing the number of lines of a specific color in column C on the Line Detector playground. The first number is the number of Red Lines, the second is the number of Green Lines, the third is the number of Blue Lines, and the fourth is the number of Black Lines. The object of the activity is to code the VR Robot to drive forward from the Starting Point C to reach the end of the playground counting the number of lines of each color it detects to crack the Passcode and print the Passcode to the Print Console.

  • Select the Line Detector Playground.
  • Select the Starting Point C.
  • Declare four variables to store and track the number of Red Lines, Green Lines, Blue Lines, and Black Lines in column C respectively.
    • Monitor the values of the four variables in the Monitor Console. 
  • Code the VR Robot to drive from the Starting Point C to reach the end of the playground counting the number of lines of each specific color.
    • Drive the VR Robot forward for a certain distance to detect a color line.
    • Use the Down Eye Sensor to check the color of the line and increase the corresponding variable value to count the number of lines.
    • Use a loop to repeat the above steps for a set number of times to code the VR Robot to reach the end of the playground.
  • Use the [print] block to print the value of the four variables to the Print Console to crack the Color Line Passcode.

Helpful Hints

  • To select a Start Point in the Line Detector Playground, select the menu button, then select the Starting Location button.

Menu

Location

  • Use the Down Eye detects block from the Sensing category to report if the Down Eye Sensor detects red, green, or blue color. Down Eye
    • Matching Python command:Down Eye Python
  • Use the Down Eye brightness block from the Sensing category to report the brightness of an object to detect black color. Down Eye Brightness
    • Matching Python command:Down Eye Brightness Python
  • Use the repeat block from the Control category to code the VR Robot to repeat the blocks contained inside for a set number of times. Repeat Block
    • Matching Python command:Repeat Python