You will write a program that plays the game Battleship. In this program, you will be graded on having functions, as well as the ability to play the game correctly.
The game is described at: https://www.hasbro.com/common/instruct/Battleship.PDF
This is traditionally a 2-person game, where each player picks where to put their ships on a 10 x 10 matrix. Ships can touch each other, but can't both occupy the same spot. Your computer game will simulate this process by first asking player 1 where he/she wants to put the ships, and then asking player 2.
Each player is given the following ships, and each ship takes up a specific number of spots on the 10 x 10 grid:
After you determine where each player wants to put their ships, then you can prompt each player to choose a position on the opponent's board. If there is a boat in the corresponding position on the opponents board, then it was a hit, and you can use whatever you want to symbolize that it was a hit, i.e. X or 1.
In the case of a hit, the other player must mark the hit on his setup board containing the ships. Whenever a ship is sunk, the game must announce to your opponent that their ship has sunk. If there isn't a boat in the opponents position, then it is a miss, and you can use whatever you want to symbolize a miss on your board, i.e. N or 0.
The player who sinks all of their opponent's ships first is the winner!
Tips
1. You can clear the screen after each player chooses their positions for their ships, by using system("clear") available by including the stdlib.h header file.
2. Some example functions you might want to include are:
3. You can print the X's or 1s red by using the following code: cout << "\033[22;31m X \033[01;37m"; \033[22;31m turns your text red, and \033[01;37m turns your text back to white.