Gravity Game

Dennis Shasha

Omniheurist Course

Computer Science


 

Description

In this game, one side (the seeker) tries to send a projectile to a target in a known location but in an unknown gravitational field. The hider gets to place two planets of a certain total weight of 1000 in any location the hider wants. Then the seeker has 5 chances to shoot a projectile from a certain location but at any velocity (such that the total speed is 10). The hider also has 1 chance to shoot a projectile from that same location under the same speed constraint. In a game, each player plays both the hider and the seeker. Score of each player P is the closest distance to the target when P is the hider + cloest distance to the target when P is the seeker. The winner has the lowest score.

The gravity model is Newtonian. The projectile and the target weigh very little. The planets don't move. Force of a planet on the projectile is based on mass of planet/(dist*dist). The gravitational constant (G) is unity.

Architecture Team

Allow the hider to specify the locations and weights of the planets. Allow the seaker to specify the x and y components of the velocity (the game is played on the x-y plane). Display the shooting point (the origin), the target, and the planets. When start is hit, display the trajectory of the projectile. Also record how close this gets to the target. You will keep score for each player.