Your final project is to create a game called Sub Hunter. BOARD: Is a 10 x 10 grid of cells Destroyer: Represented by the @ symbol Has properties consisting of Direction facing (N,S,E,W) Depth charges - a count of remaining depth charges Strength - How much damage it can take before sinking Damage taken - how much damage it has taken from the sub Has three action points to spend each round - to be input by the player Possible Actions: Move Forward - move one square in the direction facing Turn Left - make a 90 degree turn to the left in the same square Turn Right - make a 90 degree turn to the right in the same square Ping - look for a sub. Ping allows the destroyer to "see" if the sub is within two squares of its current location. If the sub is within two squares, the destroyer only knows the direction from its position (not the distance) Depth charge - drop a depth charge Sub: Represented by the ┴ symbol Has properties consisting of Direction facing (N,S,E,W) Torpedos - a count of remaining torpedos Strength - How much damage it can take before sinking Damage taken - how much damage it has taken from the destroyer Has two action points to spend each round - to be determined by the computer Possible Actions: Move Forward - move one square in the direction facing Turn Left - make a 90 degree turn to the left in the same square Turn Right - make a 90 degree turn to the right in the same square Scope- look for a destroyer. Scope allows the sub to "see" if the destroyer is within two squares of its current location. If the destroyer is within two squares, the sub knows the direction and distance from its position Torpedo - shoot a torpedo at the ship (only the direction it is facing) Game Play: The user inputs their actions as one turn (e.g. Forward, forward, ping). The computer determines the subs actions (Scope, torpedo) The program the runs the turns, sub first then destroyer based on the users actions and the computers actions and gives appropriate messages to the user based what happens. When the destroyer runs out of depth charges it is considered to be sunk by the sub If the sub runs out of torpedos, it can run away (head for the boarder of the map) if it successfully runs away the game is a draw Depth charges - When dropped they explode in the square they are in causing full damage to that square and half damage to all the squares around it. Torpedos - run straight in the direction the sub is facing for 2 squares. They hit for full damage if the sub is on that line within two square of the launch point - otherwise they miss. You should determine damage - limits for the ships and amount caused by the weapons, that make the game playable. Extra Credit ideas - implement more! Levels to the game (Easy, Hard etc) Directional pings - only work in one direction but give exact information Launchable depth charges can go X squares away before exploding Homing torpedos Smarter sub tactics (run quiet ie. harder to find) Depth to the grid (3d array, meaning you also need depth for the charges to explode, minimum depth for scoping etc etc) Sound and more. Be creative. |
|
|
|
|