Question
Write a C program. Please add comments to describe the pieces of code. Battleship is played on a 10 x 10 grid. The game begins
Write a C program. Please add comments to describe the pieces of code.
Battleship is played on a 10 x 10 grid. The game begins with the five ships (see below) being placed Ships:
1. (C) Crusor (2 Holes)
2. (A) Aircraft Carrier (5 Holes)
3. (B) Battleship (4 Holes)
4. (S) Submarine (3 Holes)
5. (D) Destroyer (3 Holes)
You will show the player the grid without the ships. If the player's missile misses you will display an M for miss. If the player missile hits a ship then you will place an H for hit. After a ship has been sunk, you will replace the H with the actual letter for the sunk ship (see letters above). Once a ship has been sunk you will change the ship from floating to sunk. Your code needs to randomly place the five ships at the beginning of the game. Your code needs to keep track of all right and wrong guesses. The game ends when all ships are sunk. After each missile you will display the 10 X 10 Grid along with a missile counter. The goal is for the user to sink all ships with while using the least amount of missles. Somewhere on the screen below the grid you will show the five ships and whether or not that are floating or sunk. The game will have an option to display the past 10 best scores.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started