{"mode":"Blocks","hardwareTarget":"brain","workspace":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable id=\"_2.^beQjx|FGt38A,8(E\">myVariable</variable></variables><block type=\"iq_events_when_started\" id=\".NsXwU_L.OuU1l7Sho$F\" x=\"-10\" y=\"10\"><next><block type=\"iq_control_forever\" id=\"zQ1I(w[};s;8z:NuidX(\"><statement name=\"SUBSTACK\"><block type=\"iq_aivision_get_data\" id=\"Z!srEZ+xGcX%w1|$Ne]E\"><field name=\"SIGNATURE\">AI Classifications</field><field name=\"VISION\">AIVision4</field><next><block type=\"iq_control_if_then\" id=\"t~%ISqoC(M@:Iar%5tG)\"><value name=\"CONDITION\"><block type=\"iq_aivision_object_exists\" id=\"(yM8+x,XiYAGW}^Lsj+X\"><field name=\"VISION\">AIVision4</field></block></value><statement name=\"SUBSTACK\"><block type=\"iq_control_if_then\" id=\"!dO?Xo+l;#O*C3=,,_I(\"><value name=\"CONDITION\"><block type=\"iq_aivision_game_element_is\" id=\"HV2pXE}kCmFT/~~$_d`L\"><field name=\"VISION\">AIVision4</field><field name=\"OBJECTNAME\">BLUE_RING</field></block></value><statement name=\"SUBSTACK\"><block type=\"iq_screen_set_fill_color\" id=\"`JjEQ7+`g:[b|0B@@KKb\"><field name=\"COLOR\">blue</field><next><block type=\"iq_screen_draw_circle\" id=\"NucYrkf%KS;as)jpyZ,T\"><value name=\"X\"><shadow type=\"math_whole_number\" id=\"i1IUw,a`h-?yMk7At*)7\"><field name=\"NUM\">80</field></shadow></value><value name=\"Y\"><shadow type=\"math_whole_number\" id=\"?b#Lkkk;CTzFy!$KT$3z\"><field name=\"NUM\">50</field></shadow></value><value name=\"RADIUS\"><shadow type=\"math_whole_number\" id=\"Mw^^H3@sIz[oRXVr#^fq\"><field name=\"NUM\">30</field></shadow></value></block></next></block></statement></block></statement><next><block type=\"iq_control_wait\" id=\"@:EDf%1K|d2n7I.F.25/\"><value name=\"DURATION\"><shadow type=\"math_positive_number\" id=\"7$t+{toM%Wz.r7xBt)UZ\"><field name=\"NUM\">1</field></shadow></value><next><block type=\"iq_screen_clear_all_rows\" id=\"{c]r}v}BH;k[Qusr88C0\"></block></next></block></next></block></next></block></statement></block></next></block></xml>","robotConfig":[{"port":[1,6],"name":"Drivetrain","customName":false,"deviceType":"Drivetrain","deviceClass":"smartdrive","setting":{"type":"2-motor","wheelSize":"200mm","gearRatio":"1:1","direction":"fwd","gyroType":"integrated","width":"173","unit":"mm","wheelbase":"76","wheelbaseUnit":"mm","xOffset":"0","yOffset":"0","thetaOffset":"0"},"triportSourcePort":22},{"port":[4],"name":"AIVision4","customName":false,"deviceType":"AIVision","deviceClass":"aivision","setting":{"config":"{\"colors\":[],\"codes\":[],\"tags\":true,\"AIObjects\":true,\"AIObjectModel\":[\"Ball(Blue)\",\"Ball(Green)\",\"Ball(Red)\",\"Ring(Blue)\",\"Ring(Green)\",\"Ring(Red)\",\"Cube(Blue)\",\"Cube(Green)\",\"Cube(Red)\"],\"AIModelMetadata\":{\"id\":0,\"version\":1,\"name\":\"Classroom Objects\"},\"aiModelDropDownValue\":0}","isConfigured":"false"}}],"slot":0,"platform":"IQ","sdkVersion":"20230818.11.00.00","appVersion":"4.65.0","minVersion":"4.60.0","fileFormat":"2.0.0","targetBrainGen":"Second","v5SoundsEnabled":false,"downloadLanguage":"python","cppStatus":"true","cpp":"// Make sure all required headers are included.\n#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\n#include <math.h>\n#include <string.h>\n\n\n#include \"vex.h\"\n\nusing namespace vex;\n\n// Brain should be defined by default\nbrain Brain;\n\n\n// START IQ MACROS\n#define waitUntil(condition)                                                   \\\n  do {                                                                         \\\n    wait(5, msec);                                                             \\\n  } while (!(condition))\n\n#define repeat(iterations)                                                     \\\n  for (int iterator = 0; iterator < iterations; iterator++)\n// END IQ MACROS\n\n\n// Robot configuration code.\ninertial BrainInertial = inertial();\n// AI Classification Classroom Element IDs\nenum classroomElements {\n  blueBall,\n  greenBall,\n  redBall,\n  blueRing,\n  greenRing,\n  redRing,\n  blueCube,\n  greenCube,\n  redCube\n};\n\nmotor LeftDriveSmart = motor(PORT1, 1, false);\nmotor RightDriveSmart = motor(PORT6, 1, true);\n\nsmartdrive Drivetrain = smartdrive(LeftDriveSmart, RightDriveSmart, BrainInertial, 200);\n\n// AI Vision Color Descriptions\n// AI Vision Code Descriptions\nvex::aivision AIVision4(PORT4, aivision::ALL_TAGS, aivision::ALL_AIOBJS);\n\n\n\n// generating and setting random seed\nvoid initializeRandomSeed(){\n  wait(100,msec);\n  double xAxis = BrainInertial.acceleration(xaxis) * 1000;\n  double yAxis = BrainInertial.acceleration(yaxis) * 1000;\n  double zAxis = BrainInertial.acceleration(zaxis) * 1000;\n  // Combine these values into a single integer\n  int seed = int(\n    xAxis + yAxis + zAxis\n  );\n  // Set the seed\n  srand(seed); \n}\n\nbool vexcode_initial_drivetrain_calibration_completed = false;\nvoid calibrateDrivetrain() {\n  wait(200, msec);\n  Brain.Screen.print(\"Calibrating\");\n  Brain.Screen.newLine();\n  Brain.Screen.print(\"Inertial\");\n  BrainInertial.calibrate();\n  while (BrainInertial.isCalibrating()) {\n    wait(25, msec);\n  }\n  vexcode_initial_drivetrain_calibration_completed = true;\n  // Clears the screen and returns the cursor to row 1, column 1.\n  Brain.Screen.clearScreen();\n  Brain.Screen.setCursor(1, 1);\n}\n\nvoid vexcodeInit() {\n\n  // Calibrate the Drivetrain\n  calibrateDrivetrain();\n\n  // Initializing random seed.\n  initializeRandomSeed(); \n}\n\n\n// Generated code.\n\n// Include the IQ Library\n#include \"vex.h\"\n  \n// Allows for easier use of the VEX Library\nusing namespace vex;\n\nint AIVision4_objectIndex = 0;\n\nfloat myVariable;\n\n// \"when started\" hat block\nint whenStarted1() {\n  while (true) {\n    AIVision4.takeSnapshot(aivision::ALL_AIOBJS);\n    if (AIVision4.objectCount > 0) {\n      if (AIVision4.objects[AIVision4_objectIndex].id == blueRing) {\n        Brain.Screen.setFillColor(blue);\n        Brain.Screen.drawCircle(80, 50, 30);\n      }\n    }\n    wait(1.0, seconds);\n    Brain.Screen.clearScreen();\n  wait(20, msec);\n  }\n  return 0;\n}\n\n\nint main() {\n  // Initializing Robot Configuration. DO NOT REMOVE!\n  vexcodeInit();\n\n  whenStarted1();\n}","target":"Physical"}