Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

BATTLESHIP Question C++ Thanks in advance a. Each player has two grids the ocean grid and the targeting grid b. Player places their ten ships

BATTLESHIP Question C++

Thanks in advance

a. Each player has two grids the ocean grid and the targeting grid b. Player places their ten ships anywhere on their ocean grid horizontally or vertically. You cant place them diagonally nor may any part of the ship be off the grid. Ship types and number are as follows: Class of Ship Size (Segments)

Number of Ships

Battleship Size 4 Amount of ships 1

Cruiser 3 2

Destroyer 2 3

Submarine 1 4

c. A player has the option to choose to place ships manually one by one or random placement of the ships.

d. The game is of a Player vs. a Machine type, the machine moves are all random, that would include placing the ships and making the shots.

e. Alternating turns one at the time players attack each other by calling out a position on their targeting grid by matching a row and column, for example D4.

f. Grid rows are indexed with numbers (1 to 10) while columns are indexed with letters (A to J). These to be colored white.

g. For each turn, two targeting grids are displayed with appropriate shot updates. h. If the corresponding coordinate for a shot on the ocean grid is empty, a white flag (white x) is placed into this position on the targeting grid. If the space on the ocean grid has a ship on it, specify which ship was hit then put a red flag (red x) into the position on the targeting grid. Hint: for coloring text, use ANSI escape code .

i. Ship would sink if all of its segments all got hit.

j. For an empty water segments, use blue equal character (=).

k. The first player to sink all of their opponent's ships wins!

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 Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

2. Eve really enjoys the science center.

Answered: 1 week ago

Question

10. Describe the relationship between communication and power.

Answered: 1 week ago