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

  Analyze all the costs and benefits of moving to a virtual

Analyze all the costs and benefits of moving to a virtual desktop solution, and propose a minimum of four benefits of the new system over the existing one. Compare and contrast reasons why the company should choose the system you are recommending ove..

  The oracle corporation is an multinational computer

Discuss at lease 500 words. The Oracle Corporation is an multinational computer technology corporation that specializes in developing and marketing hardware systems and enterprise software products.

  Benefits and drawbacks of each format for users

Examine the benefits and drawbacks of each format for users. Determine whether you agree or disagree that Blu-ray was the superior choice technologically over HD-DVD. Provide a rationale for your response.

  What is the maximum amount of physical memory

Consider a logical address space of 256 pages with a 4-KB page size, mapped onto a physical memory of 64 frames.

  Calculate the average mpg for each vehicle

Calculate the average MPG for each vehicle. Enter a formula in cell C11 using the AVERAGE function to calculate the average value of C9:C10. Use only one argument.

  Where vs having in sql

Using WHERE or HAVING in your SQL statement, answer the following questions using the MOVIES Database available with this assignment.  Be sure to include your SQL code and a screen capture of your output for EACH question.  Do NOT decrease the size..

  Brief any two examples for data mining applications

How many cuboids are there in a 4-dimensional cube with L levels? You can assume any number for the levels. Please refer to chapter in your textbook ( Kamber) to solve the problem.

  How to boost over company-s former speed champ

Explain the definition (or definitions) of performance which you think the company utilzed. Do you believe the news release is misleading?

  Create project plan for providing a preliminary prototype

A business company wants to computerize some of the job processes currently preformed manually by its employees. You are hired as an Interface design professional to come up with a user interface.

  Might limit the effectiveness of storage protection

Describe residual data and how it might limit the effectiveness of storage protection/encryption approaches.

  Create the inverse version of the number guesser

Create the inverse version of the number guesser program. In this version of the program, the user comes up with the number and the computer will 'guess' the user's number. Your algorithm should be able to find a number between 1 and 100 within seven..

  Use a single if statement and boolean operators

Write a program that asks the user for a year and computes whether that year is a leap year. Use a single if statement and Boolean operators.

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