Background: The Pacific Ocean is a powder keg ripe for explosion
with the Imperial Red Fleet (IRF) making trouble by terrorizing the
shipping lanes between us and our interests in the Far East. The
Pacific Blue Fleet (PBF) needs a capable commander to lead them in
this time of peril. You have been selected as the new commander of
the United States Pacific Blue Fleet. Reconnaissance units have
located the enemy fleet. You job is to engage the enemy fleet and
annihilate them completely. The IRF fleet is well equipped and
possesses ships that rival your own. They would like nothing more
than to send your fleet to the bottom of the ocean. This battle
would be decided by the cunning and tactics of the commander. Mode:
The game should have three player modes: player vs. player or
player vs. computer or computer vs. computer. Goal: Strategically
place your ships throughout your part of the ocean to keep them
away from the enemy. Try and sink the enemy by hitting their ships
before they hit you! Skill Level: When the game is in player vs.
computer mode, there should be 3 skills levels. The skill levels
are as follows: Beginner: The computer randomly guesses selects
coordinates. No intelligence involved. Intermediate: The computer
will make an educated guess passed on previous hit. For instance,
if computer achieved hit, it should check next available coordinate
along x coordinate. Expert: The computer will make an educated
guess passed on previous hit. For instance, if computer achieved
hit, it should check next available coordinate along x axis and/or
y axis. Ocean Grids: The Pacific Ocean is broken up into two ocean
grids: one grid for each fleet. An ocean grid consists of a 10 x 10
grid. Each position on the grid will be represented by a two
positive integers that constitutes a XY coordinate. Ships: There
are a total of 5 ships for both the PBF and the IRF respectively.
Each fleet has the same complement of ships. The description of the
ships is listed below including the number of hits needed to sink a
ship: Aircraft Carrier 5 hits Battleship – 4 hits Cruiser – 3
Hits Destroyer 3 hits Submarine – 2 Hits Deployment: Each ship
will be strategically placed in their part of the ocean. Ships must
be placed horizontally or vertically. It cannot be diagonal.
Basically, for each ship placement, either the x or y coordinate
must be the same for every coordinate of that particular ship. For
example, a cruiser could be: (8,1) (8,2) (8,3) or a battleship
could be: (5,3) (6,3) (7,3) (8,3) How to Begin: When the game
begins, the program should prompt the PBF player to enter the
coordinates of every ship in the PBF fleet one at a time. Once all
of your ships have been entered, the IRF player will enter the
coordinates for all of the ships of their fleet. Game Rules: The
PBF player will fire first by entering a XY coordinate. If the
entered coordinate scores a hit (i.e. the entered coordinate
corresponds to a position on the ocean grid occupied by an enemy
ship) the program should indicate that an enemy ship was hit. The
PDF player would be allowed to enter in another coordinate. Once
the PBF player one misses (selecting a coordinate that is not
occupied by an enemy ship), player 2 would be asked to enter a
coordinate. Once a player sinks a ship, the program should indicate
that ship was sunk and specify which ship was sunk. Note: The
program should not indicate the type of ship when it is first hit.
It should only be specified once the ship is sunk. The first player
that sinks all of the enemy ships will win the game. Error
Checking: The game should have some basic error checking
functionality built-in. The following functionality should be
included: The game should check to make sure that multiple ships
are not placed on the same coordinates. When deploying a ship, the
game should insure that the players place acceptable coordinates
for each ship. For example, if a ship has a 1st coordinate of
(2,1), it should not accept (3,4) as a second coordinate because
they are not continuous. The game should make sure that when a
player fires on a ship, they don’t select a coordinate outside of
the grid. The game should make sure no ship is placed on a
coordinate outside of the grid. The game should not allow a player
to fire at the same coordinate more than once during a game. Bonus
Points: For those individuals interested in an additional
challenge, here are some ideas for enhancements: The game requires
that the program prints a response indicating when a ship is hit.
Modify the program so that it randomly responds with different
messages when a ship is hit. For example: “Great shot” “Hit her
again!” “Go for the kill!” If you have other ideas for bonus
points, they may be submitted for consideration What to turn in:
You need to turn in the following: Software requirements
specification outlining what you program will do, any assumptions,
class / function diagram and “will-do” list Complete printed out
source code including any user created header files: Sample output
for various runs to illustrate the game in action Submit a soft
copy of all source and executable files. Instructions for playing
the game Sample Run: PBF player enter ship coordinates: Carrier 1st
coordinate: 1 2 Carrier 2nd coordinate: 1 3 Carrier 3rd coordinate:
1 4 Carrier 4th coordinate: 1 5 Carrier 5th coordinate: 1 6 Your
carrier has been deployed! Battleship 1st coordinate: 5 6
Battleship 2nd coordinate: 4 6 Battleship 3rd coordinate: 3 6
Battleship 4th coordinate: 2 6 Your battleship has been deployed!
…… And so on for the rest of the PBF ships …. IRF player enter ship
coordinates: Carrier 1st coordinate: 4 9 Carrier 2nd coordinate: 5
9 Carrier 3rd coordinate: 6 9 Carrier 4th coordinate: 7 9 Carrier
5th coordinate: 8 9 Your carrier has been deployed! Battleship 1st
coordinate: 8 3 Battleship 2nd coordinate: 8 4 Battleship 3rd
coordinate: 8 5 Battleship 4th coordinate: 8 6 Your battleship has
been deployed! …… And so on for the rest of the IRF ships …. Start
the battle! PBF fire at a coordinate: 5 5 You missed! IRF fire at a
coordinate: 2 6 Direct hit! IRF fire at a coordinate: 3 6 Direct
hit! IRF fire at a coordinate: 4 6 Direct hit! IRF fire at a
coordinate: 5 6 Direct hit! You sank the PBF battleship! IRF fire
at a coordinate: 1 1 You missed! PBF fire at a coordinate: 8 6
Direct Hit! …. PDF, you win! Great game! IRF, you are demoted!
Return home in shame! Would you like to play again? (Y/N)
No comments:
Post a Comment