Question
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
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