Back in a time when Pac Man and Donkey Kong were the most popular games in the arcades, home computers were not quite so sophistcated as they are now. A few free computer games could be loaded off of bulletin boards over modems that had baud rates of 1200bps. Floppy disks were 5-1/2" black bendable squares with a hole in the middle large enough to stick a few fingers through. Green screens and amber monitors produced 'high resolution' images where you could distinguish each individual pixel. Ah, those were the good old days. Ok, ok. Enough reminiscing. On to the project.
One of the computer games that some early programmers wrote for these home computers was a very simple, but suprisingly fun, 2 player game that involved a little differential equations ('fun' and 'differential equations' in the same sentence, I can tell you are skeptical). Two cannons are placed on opposite sides of a mountain and take turns firing at one another. A 'turn' consists of choosing an angle and a force at which to fire off a shell from your cannon so that the shell passes over the mountain and lands on your opponent (ouch). If your shell misses your opponent, then your opponent has gets to take a turn and fire back. To make sure that the game is different every time, the cannons are placed at a random distance from the mountain, a breeze blows either from the right or left at a random speed and the mountain is set to a random height, but these parameters stay the same from turn to turn within a game.
A simple example of cannons on opposite
sides of the mountain drawn in Maple
The pieces were all drawn with shapes
from the plottools package.
Write a Maple function that plays this game and draws the animation of the shell flying over the mountain. If the shell hits the mountain or the ground or the other cannon or your cannon (if the shell should get blown back in your direction), or if the shell leaves the boundary of the image then the turn is over. You will probably write two functions (esentially the same), one for the left cannon and one for the right. The input to the function will be values for the location of the cannons, the wind speed, the height of the mountain. You will have to limit appropriate values for these variables. For instance, the mountain should not be higher than the image, the cannons should not be inside the mountain, the wind speed should be strong enough to effect the trajectory of the shell but not hurricane force, etc. These parameters stay the same from turn to turn (they may be a global variable for example which get set only at the start of a game). In addition there are two more parameters which are chosen by the player: the angle at which the shell is fired and the speed at which it leaves the cannon.
The 'differential equation' part of this problem arises in calculating the trajectory of the shell shot from a cannon. A cannonball will have an initial speed specified by the player, this speed will change based on the influence of two things, gravity and the speed of the wind. There is a third influence which you may or may not choose to include in your equation and that is wind resistance (an acceleration proportional to the speed of the cannonball). There should be several ways of approaching this problem involving solving this differential equation exactly or finding an approximate solution by calculating the next position of the the cannonball from the previous position and its speed.
You may add various options as you please to make this game more sophisticated: computer targeting, air resistance, different sorts of weapons, fancy graphics, a 'Star Wars'-like defense system, etc. The original game however was perhaps less sophisticated than the picture that I have drawn above written in the computer language BASIC.
Just a note: you should not use Maple's input commands (like scanf, etc.) because their effect is unpredictable should you make a typing mistake. An example game should proceed like the example that I am providing here.