Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I am currently stuck on a programming assignment for my C# class. The teacher hasn't reviewed this content yet but still refues to drop

Hello, I am currently stuck on a programming assignment for my C# class. The teacher hasn't reviewed this content yet but still refues to drop the assignment because the course designer has made it mandatory. I need the solution to the following question to be completly in C#:

Refactor your Battleship drawing code from Module 1.

Download the OO template for the basic battleship game, BattleshipRefactor.zip.

https://drive.google.com/open?id=0B5NxcNUHQCuVSFp1U3cwejFaUmc (This is the download link for the required code template.)

The template has the outline of a battleship game using OO constructs. You need to add the Grid class and complete the code so that it runs correctly.

At a minimum, you need to complete the Draw and DropBomb methods with code similar to the previous assignment. There will be changes due to the different layout, but the core of your code will do the same thing.

In this Module we are adding 2 new features:

Variable sized grid the trivial part of this is making a 2D array based on the passed in size.

The second part is adding some ships to that grid we cannot use the constant array from Module 1. You need to come up with a very simple algorithm to add a few ships to the grid. This is purely test code so it doesn't have to be sophisticated in any way (there is time for that later in the class). If you can't think of any ways ask in the forums. Do not ask the user (your teacher) for input to place these ships.

Game over detection. This will be implemented in the readonly property Grid.HasShipsLeft. In this property you will determine if there are any ships left not hit with a bomb. The algorithm should look through the array forany remaining ships each time the property is read.

You may add as many other methods, fields or properties as you feel are required for the assignment. Notes:

The code will be tested with grids ranging in size from 5 (the smallest you can fit a size 5 ship) upwards. Make sure that all aspects of the game work correctly without crashing or hanging.

You must use the template code provided!

Like in Module 1, please make sure you show the ships in the grid. At this point we are merely testing our game logic and hidden ships make the game very hard to test.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

Briefly describe the ETL process for building a data warehouse.

Answered: 1 week ago

Question

Having an obese friend increases the likelihood of obesity.

Answered: 1 week ago