The game is played on four square grids, two for each player. The grids are to be 10x10 square and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots.
Before play begins, each player arranges a number of ships secretly on the grid for that player. Each ship occupies a number of consecutive squares on the grid, arranged either horizontally or vertically. The number of squares for each ship is determined by the type of the ship. The ships cannot overlap (i.e., at most one ship can occupy any given square in the grid). The types and numbers of ships allowed are the same for each player.
We will use the following ships:
Type of Ship Size aircraft carrier 5 battleship 4 destroyer 3 submarine 3 patrol boat 2
After the ships have been positioned, the game proceeds in a series of rounds. In each round, each player has a turn. During a turn, the player announces a target square in the opponents' grid which is to be shot at. If a ship occupies the squares, then it takes a hit. When all of the squares of a ship have been hit, the ship is sunk. If at the end of a round all of one player's ships have been sunk, the game ends and the other player wins.
Your program is to first allow the user to establish a connection with another person. One person is be the "server" while the other person is to be the "client". The same program must be used for the server and the client. Once a connection is established. The players are allowed to place their ships on a grid. Once the ships have been placed, the guessing of locations begins. When a game is over, ask the players if they want to play another game. If they do, allow the users to place their ships on the grid. Otherwise, break the connection between the client and server.
The program us to have menu bars that will allow the user to exit the program, view an about box, view a help box (while only one is required, it is suggested that you have two - one for help on the connection side of the program and one for the battleship game "side"), establish the connection between the two players (this may require multiple menu items), and a simple statistics box.
This program will also require a 1-2 page write up of the data structures used in the program and the logical division of your program into multiple source code files (i.e. which routines are where). Remember that this write-up is to be written in ASCII format and is to be electronically turned in with your program. The name of this file should be "readme.txt". Note: you may also use the JavaDoc feature in Java to create this readme file. Also recall that your program will be given to another student to write a critique. Therefore, it is suggested that you do not include your Social Security Number in your program. Instead use your name and your CS User ID to identify yourself.
Your program must be written in good programming style. This includes (but is not limited to) meaningful identifier names, a file header at the beginning of each source code file, a function header at the beginning of the function, proper use of blank lines and indentation to aide in the reading of your code, explanatory "value-added" in-line comments, etc.
The work you turn in must be 100% your own. You are not allowed to share code with any other person (inside this class or not). You may discuss the project with other persons; however, you may not show any code you write to another person nor may you look at any other person's written code.
You are to submit this project using the CS Department's UNIX machine's turnin command. The project name for this assignment is proj5. Be sure to submit all source code, header files, makefile as well as your program description. Failure to turnin all required pieces will result in a lower grade for the assignment.