Project Trwo
Design Due 27 May, Program Due 4 June
Intro:
You are going to write a program to play the game Artillery. Artillery is a two player game (played between one human player and a computer player ) where each player gets an artillery piece. The pieces are separated by some X meters and the players take turns shooting at each other. The player who is the first to land a shall within a certain distance of the enemy artillery piece wins. Players take turns by picking an angle (in degrees ) relative to the horizontal and a speed (in meters pers second ) for their shell. The computer then calculates the distance that a shell travels in meters. If the shell lands within a certain distance of the enemy, the game is over.
Details:
Here are some things to make the game fun!! (ie: REQUIRED FEATURES!!!)
- A single run of the program should allow the user to play multiple games of artillery.
- Each game, a new distance X is calculated. Say, X is between 100-200 meters ( your choice ). The user should be informed of this distance.
- The user should also be informed of how far each shot fired travled and about any decisions made by the computer player.
- The user will play against a computer player ( with the user going first ). The computer player picks a random theta ( from between 0 and 90 degrees ) and a random speed ( between 0 m/s and say 100 m/s - your choice )
- When the user is done playing, if the user won more than 90% of their games, say something REALLY nice. If they won 75%-90%, then say something less nice. Otherwise, insult the user for their poor performance.
- Here is the output of a same of my solution ( click here ).
Design Extras:
The design document is worth 40 points. 20 points for correctness, 20 points for following the style discussed in class. The document is due in to me via an emailed TEXT file by 11:59pm of the due date.
Hints:
- For a given angle theta ( in radians ) and a given speed s, the horizontal distance for a shell is given by the equation d = s*s*sin(2*theta)/9.8
- The user inputs angles in degrees, but the Math.sin function assumes that the angle is in radians. Given that there are 2*3.14 radians for every 360 degrees, you could write a handy conversion function. Or, you could sniff around and see if the Math class has a neat function for you.
- Use good design first, otherwise this program will be an awful mess.
- START EARLY!!!!! Feel free to email me for helpful comments or suggestions on your design documents.
- Remember to use the style that we discussed in class. Feel free to use your own, but at some point, you have to convert it to my style when you show it to me.
Extra Credit:
- A better computer player would be nice.
- Invent and implement your own style of weapons.
Grading Criteria
This program is worth 75 points. The largest amount of points a non compiling program can earn is 25 points. From this total, 2 points per error will be deducted until no more errors are found or there are no points left.
Style is very important. All variables should have useful names, all lines of code should be indented, and there should be comments about once every 5-10 lines. Each violation is subject to a 2 point deduction to a maximum of 26 points.
For each functionality listed above that is not completed, a maximum 8 point penalty will apply.