Skip to main content

Coordinate City

Challenge: In the Coordinate City, the School is at coordinates (375, 415), the Library is at coordinates (-625, 415), the Store is at coordinates (-625, -300), and the Park is at coordinates (600, -300). The city has four quadrants numbered from 1 to 4, as shown in the Coordinate City Map. The object of this activity is to code the VR Robot to mark the location of each building on the map with a specific color(please see the following image), then determine the quadrant each building lies in.

Table of 4 named coordinates with corresponding colors. The first is School at (375, 415) and marked as red, the second is Library at (-625, 415) and marked as blue, the third is Store at (-625, -300) and marked as yellow, and the last is Park at (600, -300) and marked as green.

  • Choose and Download the Coordinate City activity worksheet as a PNG file from this Google slideshow.
  • Select the Art Canvas+ Playground and upload the activity worksheet.
  • Code the VR Robot to mark the location of each building on the map with a specific color.
    • Declare variables to store the x-value and y-value of the coordinates for each building.
    • Code the VR Robot to move to each position according to the coordinates. Drive the robot in the directions parallel to the x-axis or the y-axis using the x-values and y-values to calculate the drive distance.
    • Use the VR Pen to draw a dot at each position with a specific color.
  • Design an algorithm to determine which quadrant each building lies in.
    • Use Greater thanLess than, and and blocks to determine which quadrant each building lies in according to its coordinates.
    • Use the [print] block to print the quadrant number for each building to the Print Console.

Helpful Hints

  • Use My Block from the My Blocks category to create a custom block to determine the quadrant a point is in. The My Block makes the project shorter and more easily readable.VEXcode My blocks Definition block that reads 'define quadrant'.
    • Matching Python command:

      def quadrant():
  • For help with using My Blocks in the project, please select the “TUTORIALS” button in VEXcode VR and choose the My Blocks Tutorial. VEXcode VR My Blocks Tutorial icon.
  • Use the Greater Than comparison block from the Operators category to report if the first value is greater than the second value.VEXcode Greater than block that reads '375 > 0'.
    • Matching Python command:

      if 375 > 0:
  • Use the Less Than comparison block from the Operators category to report if the first value is less than the second value.VEXcode Less than block that reads '375 < 0'.
    • Matching Python command:

      if 375 < 0:
  • Use the and block from the Operators category to report if two Boolean conditions are both true.Empty VEXcode And block that reads 'and'.
    • Matching Python command: 

      and