Grid: | ||
Tics Lines: |
|
Width
px
|
Hash Lines: |
|
Width
px
|
Labels: |
|
Font
px
|
Trace Lines: | ||
Robot 1: |
|
Width
px
|
Robot 2: |
|
Width
px
|
Robot 3: |
|
Width
px
|
Robot 4: |
|
Width
px
|
Axes: | x-axis | y-axis | Show Grid |
Grid: | 24x24 inches | 36x36 inches | 72x72 inches |
96x96 inches | 192x192 inches | ||
Quad: | 4 quadrants | 1 quadrant | Hardware |
Units: | US Customary | Metric |
Background: |
![]() |
|
|
|
|
|
|
|
|
|
/* Code generated by RoboBlockly v2.0 */ #include <chplot.h> double probAns; double blueAns; double blueCount; double redCount; double i; double x; double y; double question3; CPlot plot; printf("Is the probability of a randomly placed point going in the red area the same as it going in the blue area? (Please input yes or no)"+"\n"); scanf("%lf", &probAns); printf("If 100 points get placed randomly on the grid, how many would you expect to land in the blue area? Please round answer to nearest whole number. "+"\n"); scanf("%lf", &blueAns); plot.strokeColor("black"); blueCount = 0; redCount = 0; for(i = 1; i <= 100; i++) { x = randint(0, 36); y = randint(0, 36); if (x < 6 && y < 27) { blueCount = blueCount + 1; } else if (x > 27 && y < 18) { redCount = redCount + 1; } plot.point(x, y); delaySeconds(0.01); } printf("There were %g points that actually landed in the blue area.\n", blueCount); printf("If the number of points that landed in the blue area was different from what you predicted, are you surprised? If the amount of points is the same as your prediction, would you expect this result to happen every time? (Please input yes or no)"+"\n"); scanf("%lf", &question3); plot.axisRange(PLOT_AXIS_XY, 0, 36); plot.ticsRange(PLOT_AXIS_XY, 6); plot.sizeRatio(1); plot.plotting();
Problem Statement: The board blocks will generate a blue and red area. When you run the program It will place 100 points randomly on the grid and ask you some questions about the likelihood of the points being placed in specific places. |
|||||||||||
|
|||||||||||