Create a game of Battleship.
This should be a game of player vs AI.
How the game is played:
Each player has a 10 by 10 board on which to place their pieces.
There are 5 pieces:
Air Craft Carrier - 5 long
Battleship- 4 long
Cruiser- 3 long
Submarine- 3 long
Destroyer- 2 long
These are to be placed on the board vertically or horizontally. They CANNOT go diagonally and CANNOT over lap each other and MUST be inside the 10 by 10 board. Let the player choose where they want to place their pieces following the above rules. Then randomly assign the pieces for the computer.
Once the board is set it is time to start guessing locations. Don’t let people guess spots off the board. Two boards should be displayed to the screen. One board showing the players ships and where the computer has guessed, another showing the players guesses and whether it was a hit or miss. Label each board so they know which is which. Make sure the boards are easy to read and instructions are given so the player knows how you want them to play the game. Are rows and columns 0-9 or 1-10? Are they entering column then row or row then column?
If either player hits, print out which ship was hit: Example “Player 1 hit the computers Submarine”. If they hit all parts of the ship let them know it was destroyed. Example: “The computer sunk your Battleship”
For the computer you should have it randomly guess. If it ends up getting a hit you should save the value of the location of the hit and on the next guess have it pick a random spot on either side of the last hit. The smarter the better.
Once one player has sunk all of the other players ship the game ends and announces the winner. You should have the option to play again. Once playing is over let the user know how many wins and losses they got.
Place player ships: 15% (receive at most 7.5% if player does not set them)
Place computer ships: 15% (receive at most 10% if not random)
Guess place for ship (not going out of bounds): 10%
Check properly if that guess hits a ship: 10%
Print updated board of the players guesses: 10%
Print updated board of the players ships (indicating if hit or not by computer): 10%
Check to see if a ship is sunk and print out message: 10%
Check to see if there is a winner: 10%
Computer AI for guessing: 10% (will get 5% if just completely random guess)