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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!