Here is an example of how a typical assignment might run. The function startgame(); sets some global variables and then draws the picture of where the starting positions are and the wind speed. The functions leftplr and rightplr execute a turn for the left and right cannon. Notice how the wind affects the bullet's trajectory.
Wind = 2
Mountain height = .45
Left position = .20
Right position = .52
Instructions: Player 1 is on the left, player 2 is on the right
side of the mountain. Each player takes turns firing a shell
over the mountain by specifying an angle and a projectile force.
The angle should be between 0 and 90 degrees, the force should
be a real number between 0 and 15.
Command for player 1: leftplr( angle, force );
Command for player 2: rightplr( angle, force );
> leftplr( 75, 6.2);
> rightplr( 60, 8);
Back to the cannon assignment
Back to Math 2042