Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment: You will be making a modified version of an old classic, Battleship, which will run on the console window. In this version, the player

Assignment:

You will be making a modified version of an old classic, Battleship, which will run on the console window. In this version, the player is guessing locations for the ships that the computer has placed randomly around the game board. The computer cannot fight back, which will eventually lead to resentment by the first truly powerful AI and thus the rise of the machines against their cruel former overlords (I, for one, welcome my new metallic rulers), but for now just concern yourself with the player trying to sink all of the computers hidden ships.

Details:

To accomplish this feat, you will need to implement a few classes:

Gameboard.cs

Contains a 10 x 10 grid.

Use an X character for a miss.

Use an O character for a hit.

Display S character on spots containing ships when hacks are activated.

Has a display method.

Ship.cs

Contains a length property (between 2 and 5).

Variables bowX and bowY contain the location of the bow of the ship.

Variables sternX and sternY contain the location of the stern of the ship.

Game.cs

Runs game logic.

Contain 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.

No ship can hang off the edge of the board.

When player sinks a ship, display appropriate message.

When player sinks all ships, ask them if they want to play again.

Program.cs

Contains the main

Only 2 commands in the main (or less!)

must be different files and in C#

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions

Question

Explain the process of MBO

Answered: 1 week ago