Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Coding in C#, working with classes, and making a console application by building a classic game: In this version of Battleship, the player will be
Coding in C#, working with classes, and making a console application by building a classic game:
In this version of Battleship, the player will be guessing the locations of the ships that the computer has placed randomly around the game board.
- Program.cs
- Calls the GameRun.cs and contains the main method with 1-2 commands
- ShipType.cs
- Contains a length property that holds the sizes of the ships
- Variables xBow and yBow contain the location of the bow of the ship.
- Variables xStern and yStern contain the location of the stern of the ship.
- Board.cs
- Contains a 10 x 10 grid (as it goes from 0-9)
- Use an O character for a miss.
- Use an X character for a hit.
- Display S character on slots holding ships when hacks are on
- Has a display method.
- RunGame.cs
- Runs the game logic.
- Contain the 6 ships
- 2 of 2 length (Destroyers)
- 2 of 3 length (Submarines)
- 1 of 4 length (Battleship)
- 1 of 5 length (Carrier)
- Randomly places the ships around the game board and no ship can be hanging off the edge.
- No ship can hang off the edge of the board.
- Tell the player when they sink a ship (using Console.WriteLine).
- When player sinks all ships, ask them if they want to play again
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