Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

In the game of battleships, the game play area is a square grid containing ships. Players take it in turns to guess the location of the ships until the battleship is sunk.

A simple solution has been provided that has the basics of rendering a grid and asking for input. It does not look very pretty.

Your assignment is to improve on the rendering and complete the input part of the gameplay.

1. Improve the rendering so that each grid square is represented by a box created out of characters.

e.g.

#---#

| |

#---#

2. Improve the rendering so that each ship type is in a different color. Ships should be visible, not hidden from view. Yes, that's a bad game but we are just using this to test our algorithms and design.

e.g.

#---#

| S |

#---#

3. Improve the rendering so that the grid has horizontal labels (A through J) and vertical labels (1 through 10)

4. Parse the input to get the guess in the form LetterNumber e.g. B7, G10, A1. You will find String.SubString and Int32.TryParse to be useful API calls. Invalid input should cause the input to be asked again - it should not be possible to crash your program with bad input

5. When you have a valid input mark the grid location as used and then render an X in the square to indicate it has been used. The X should be Red if it was a hit on a ship.

e.g.

Miss Hit

#---# #---#

| X | | X |

#---# #---#
Notes:
· Your grid rendering must display the ships. At this stage we are just testing parts of the game so we don't need them hidden from the user. (and it makes it much harder for one of your users to grade!)
· You do not need to determine end of game conditions, validate repeated hits or any gameplay however feel free to add any of those things if you feel the urge.
· There are many useful APIs in the Console class. You may render the grid line by line using Write and WriteLine or you may render it using the SetCursorPosition API. You may redraw the entire grid each time or simply replace the sections that have changed.

· You may find it useful to set the size of the console window to something a little larger. There are APIs to do this in the Console class. The example above is just one style of drawing - feel free to experiment with different characters and grid sizes.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91700061
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Question what will be the source and destination ip

Question : What will be the source and destination IP addresses the response packet after the router forwards it to the private network? The response must be typed, single spaced, must be in times new roman font (size 12 ...

Bierco is a beer company based in germany you purchased the

BierCo is a beer company based in Germany. You purchased the stock in 2011 for 100 Euros when the exchange rate was 1.4 EUR/ USD. Today BierCo's price is 120 Euros and the exhange rate is 1.12 EUR/USD. What is the dollar ...

Research web server vulnerabilities by choosing a site and

Research web server vulnerabilities by choosing a site and determining what kind of platform it is running on. Do not scan the server, you can use a site such as Netcraft to determine what the website is running. See if ...

Question after 1 year of launch ride sharing increased a

Question: After 1 year of launch, ride sharing increased a lot resulting in a lot of insertion requests to the database. Consider there is no room to further increase the size of server and changing database is not an op ...

To speed up memory access caching is typically used a

To speed up memory access, caching is typically used. A memory cache is a small but fast memory where data recently accessed is kept in anticipation of future references. When an access is made, if the data is in the cac ...

Represent each of the following values in the ieee 754

Represent each of the following values in the IEEE 754 32-bit format, truncating inexact values. Indicate the percent error of the value stored compared to the exact value. This will require you to convert the 32 bit flo ...

One of the 5 halogens which are diatomic has the fastest

One of the 5 halogens (which are diatomic) has the fastest root mean square velocity at STP. Calculate this velocity in meters per second.

Are risk-averse people more likely to order their steak

Are risk-averse people more likely to order their steak well-done? A survey was conducted that asked individuals a series of questions about risk and how the individual prefers their steak (if at all). In particular, one ...

The below figure represents the potential outcomes of your

The below figure represents the potential outcomes of your first salary negotiation after graduation. Assuming this is a sequential-move game with the employer moving first, indicate the most likely outcome. Does the abi ...

Strategies when resources are constraineda project manager

Strategies When Resources Are Constrained A project manager has fewer options for accelerating project completion when additional resources are either not available or the budget is severely constrained. This is especial ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As