The game play area is a square grid containing ships

Assignment Help Basic Computer Science
Reference no: EM13991215

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.

Reference no: EM13991215

Questions Cloud

Determine the mass-to-charge ratio of the ion : In the velocity selector the electric field has a magnitude of 8428 V/m, and the magnitude of the magnetic field in both the velocity selector and the deflection chamber is 0.0941 T. If in the deflection chamber the ion is detected at a distance o..
Explain how the strategy matches the type of environment : What type of operations and supply chain environment has more difficulty managing capacity— an environment supporting standardized products and services or one that supports customized products and services? Explain. Explain how the strategy matches ..
Main contribution to the fundamentals of organizing : What was Graicunas' main contribution to the fundamentals of organizing? The central concern of span of management is to: One of Henri Fayol's guidelines for organizing resources is to avoid red tape, regulations, and paperwork. After a manager has d..
The formation of the mitotic spindle : Many anti-cancer drugs inhibits the formation of the mitotic spindle. what affect will this have on cell division?why?
The game play area is a square grid containing ships : 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.
What to recongizne promtoer and results in what : Core rna polmerase joins with what to recongizne promtoer and results in what
Different models of competition between firms : Discuss the similarities and differences between these special models. Be sure to explain the different circumstances where one model might be more appropriate to use than another.
What are the advantages of each type of microscopy : What are the advantages of each type of microscopy? Light vs fluorescence vs. EM and what parts of the cell is best visualized for each?
External environment assessment : Each of the following forces are outside the organization and require management to react in some way. There are comments in each section regarding the trends in this area and how they might impact the organizations performance.(Automatic Data Proces..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Write the implementataion of my animal class

Below is the header for my animal class. I need to create a derived class based on my animal class.

  Explain effects of fiscal policies on economy-s production

Explain effects of fiscal policies on economy's production and employment. How do changes in government spending and taxes positively or negatively influence economy's production and employment?

  Networks present of opportunities for security challenges

1. Networks present a lot of opportunities for security challenges. What type of network are you on, and what security elements are employed? Are they effective? Why or why not?

  Four techniques for analyzing

Briefly compare and contrast the four techniques for analyzing the costs and benefits of a proposed system. What do you see as particular strengths and weakness of each method?

  Research two asymmetric encryption algorithms

Research two asymmetric encryption algorithms. For each algorithm, list the key lengths used, outline the encryption process, and name at least one application that uses the algorithm. This assignment must be 1 page. Cite all sources/ reference..

  Which of the following runs as a dedicated server only

Which of the following runs as a dedicated server only?

  Using a competitive ratio measure

Imagine you are standing next to a long fence, extending as far as you can see in both directions. You want to cross the fence and you know that somewhere it has a hole you can go through. But, you don't know whether the hole is to your right or..

  Experiment based analysis and simulation based analysis

Outline two advantages and two limitations (each) of experiment-based analysis and simulation-based analysis.

  Compares unix type operating system and window multi tasker

Analysis that compares and contrasts a UNIX type operating system and a specific Windows multi user or networking operating system

  An approved topic in mobile computing and commerce

This choice allows you the freedom to explore newer topics in mobile computing and commerce technologies. Youust have your topic approved by your tutor. Please submit a topic proposal of no less than 200 words to your tutor before you begin work.

  Suppose a c++ compiler for the mips

Suppose a C++ compiler for the MIPS machine associates $s5 with array a and $s6 with variable i. How does it translate a[i] = a[i+1]; into MIPS assembly language?

  Create advantages and efficiencies for an enterprise

Discuss how server virtualization, architecture, and Hyper-V can create advantages and efficiencies for an enterprise, including considerations for how to decide what an enterprise should factor in when calculating Return on Investment (ROI) befor..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd