### Learning Math and Coding with Robots

 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:

#### Robot 1

 Initial Position: ( in, in) Initial Angle: deg Current Position: (0 in, 0 in) Current Angle: 90 deg Wheel Radius: 1.75 in1.625 in2.0 in Track Width: in

#### Robot 2

 Initial Position: ( in, in) Initial Angle: deg Current Position: (12 in, 0 in) Current Angle: 90 deg Wheel Radius: 1.75 in1.625 in2.0 in Track Width: in

#### Robot 3

 Initial Position: ( in, in) Initial Angle: deg Current Position: (24 in, 0 in) Current Angle: 90 deg Wheel Radius: 1.75 in1.625 in2.0 in Track Width: in

#### Robot 4

 Initial Position: ( in, in) Initial Angle: deg Current Position: (36 in, 0 in) Current Angle: 90 deg Wheel Radius: 1.75 in1.625 in2.0 in Track Width: in

Animate Ball Throw Using Sin( )
Problem Statement:

The pre-placed blocks will display shapes representing a person facing forward with a ball, and after repeating some actions, will display a person throwing a ball. Replace x-position values of each shape using sin() and the variable “Cycle” so that the person will make 1 and a half rotations before throwing the ball.

```/* Code generated by RoboBlockly v2.0 */
#include <chplot.h>
double Cycle;
double i;
CPlot plot;
int count;

Cycle = 0;
count = 0;
while(count < 13) {
plot.strokeColor("#ffcc66");
plot.fillColor("#ffcc66");
plot.circle(3 * sin(deg2rad(Cycle)) + 12, 12, 1);
plot.strokeColor("red");
plot.fillColor("red");
plot.rectangle(11 + 3 * sin(deg2rad(Cycle)), 5, 2, 5, 0);
plot.strokeColor("#000066");
plot.fillColor("#000099");
plot.triangle(11 + 3 * sin(deg2rad(Cycle)), 5, 13 + 3 * sin(deg2rad(Cycle)), 5, 12, 0);
if (!((Cycle + 180) % 360 == 0)) {
plot.strokeColor("#ffcc66");
plot.fillColor("#ffcc66");
plot.triangle(12 + 3 * sin(deg2rad(Cycle)), 10, 12 + 3 * sin(deg2rad(Cycle)), 8, 12 - 2 * sin(deg2rad(Cycle)), 9);
plot.strokeColor("#666666");
plot.line(12 - 2 * sin(deg2rad(Cycle)), 9, 12 - 7 * sin(deg2rad(Cycle)), 9);
plot.fillColor("#666666");
plot.circle(12 - 7 * sin(deg2rad(Cycle)), 9, 1);
}
Cycle = Cycle + 45;
delaySeconds(0.2);
count = count + 1;
}
i = 0;
for(i = 0; i <= 3; i++) {
plot.strokeColor("#ffcc66");
plot.fillColor("#ffcc66");
plot.circle(11, 12, 1);
plot.triangle(12, 10, 12, 8, 16, 11);
plot.strokeColor("red");
plot.fillColor("red");
plot.rectangle(11, 5, 2, 5, 0);
plot.strokeColor("#ffcc66");
plot.fillColor("#ffcc66");
plot.triangle(12, 10, 12, 8, 15, 7);
plot.strokeColor("#000066");
plot.fillColor("#000099");
plot.triangle(11, 5, 13, 5, 12, 0);
plot.triangle(11, 5, 13, 5, 8, 0);
plot.strokeColor("#666666");
plot.line(18 + i * 20, 11 + i * 10, (21 + 2.5 * sqrt(3)) + i * 20, 13.5 + i * 10);
plot.fillColor("#666666");
plot.circle((21 + 2.5 * sqrt(3)) + i * 20, 13.5 + i * 10, 1);
delaySeconds(0.2);
}

plot.label(PLOT_AXIS_XY, "");
plot.grid(PLOT_OFF);
plot.tics(PLOT_AXIS_XY, PLOT_OFF);
plot.axis(PLOT_AXIS_XY, PLOT_OFF);
plot.axisRange(PLOT_AXIS_XY, 0, 72);
plot.ticsRange(PLOT_AXIS_XY, 6);
plot.sizeRatio(1);
plot.plotting();```
 Blocks Save Blocks Load Blocks Show Ch Save Ch Workspace
Problem Statement:

The pre-placed blocks will display shapes representing a person facing forward with a ball, and after repeating some actions, will display a person throwing a ball. Replace x-position values of each shape using sin() and the variable “Cycle” so that the person will make 1 and a half rotations before throwing the ball.

Time