Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

b. Explain how you initially felt about the communication.

Answered: 1 week ago

Question

3. Identify the methods used within each of the three approaches.

Answered: 1 week ago

Question

a. When did your ancestors come to the United States?

Answered: 1 week ago