Skip to main content

Robot Dice App

Challenge: Build a Robot Dice App on the Art Canvas + Playground! The object of the activity is to create an algorithm to generate a random number and code the VR Robot to fill the corresponding dice face on the canvas with the same color as its outline to show the generated number.

  • Download the Robot Dice App activity worksheet as a PNG file from this Google slideshow.
  • Select the Art Canvas+ Playground and upload the Robot Dice App activity worksheet image.
    • To learn more about uploading images to the Art Canvas+ Playground, see this article.
  • Use the pick random block to generate a random number between 1 and 6. Declare a variable to store the generated number.
  • Code the VR Robot to show the generated number on the Art Canvas +.
    • Use [Drive for] and [Turn for] blocks to code the VR Robot to drive into the dice face corresponding to the generated number.
    • Use the VR Pen to fill in the face with the same color as its outline.
    • Monitor the variable value in the Monitor Console. Use the [print] block to print the generated number to the Print Console. 
  • Play your favorite board games with a friend and use the Robot Dice App to roll the dice!

Helpful Hints

  • Use the pick random block from the Operators category to report a random value between the lowest and highest values in the block. Pick Random
    • Matching Python command:Pick Random Python
  • Use the set block from the Variables category to set the value of the variable. Set Dice Block
    • Matching Python command:Set Dice Python
  • For help with storing data in the project, please select the “TUTORIALS” button in VEXcode VR and choose the Storing Data Tutorial.

Tutorials

Storing Data Tutorial

  • For more information about the name rules for variables in VEXcode VR, please see this article.
  • Use the Equal to comparison operator block from the Operators category to check the dice value. Dice Block
    • Matching Python command:Dice Python
  • Use the if then block from the Control category to code to perform behaviors based on the Boolean condition. If the Boolean condition is true, the blocks inside of if then block will run. If Then Dice
    • Matching Python command:If Then Dice Python