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

  How have precision guided munitions and remotely

How have Precision Guided Munitions and Remotely Piloted Aircraft affected contemporary warfare and tactics? Discuss how these and other technological innovations affected American warfare in Iraq and Afghanistan.  Willard of them make other forms of..

  Which attack exploits the session initiation

Which  attack exploits the session initiation between the Transport Control Program (TCP) client and server in a network?

  Windows operating system

Windows operating system

  Write the definition of the function

Write the definition of the function, leavesCount, that takes as a parameter a pointer to the root node of a binary tree and returns the number of leaves in a binary tree. Add this function to the class binaryTreeType and create a program to test ..

  Ipo chart and pseudocode

Start by analyzing the problem; use an IPO chart and pseudocode (or flowchart) to brainstorm the logic prior to start coding. Using Visual Studio code and test your program according to your pseudocode solution. Once you are satisfied with your progr..

  Create a program that asks user for number between 1 and 100

Develop a JavaScript solution to the follow problem: Create a program that asks a user for a number between 1 and 100, the program should then output to the user higher, lower, or correct, depending upon the input from the user and the random numb..

  Business processes from the traditional form to e-commerce

Discuss the following key challenges faced by a business wanting to convert its business processes from the traditional form to e-commerce processes

  Designing a small application for a fast food

Designing a small application for a fast food , where the customer can make his order by just selecting on the screen ( The program is perfectly running).

  Explain the different usability data-gathering techniques

Explain the different usability data-gathering techniques

  Design a program that will allow a user to input a list

Design a program that will allow a user to Input a list of your married male friends name (first and last name) along with their weight and first name of their spouse.

  Compare and contrast the binary search trees

Compare and contrast the Binary Search Trees (BST) featuring the balancing operation implemented with the AVL trees.

  Visit the websites of several social media sites

1) Visit the websites of several social media sites (MySpace, Facebook, LinkedIn, Twitter). What differences do you notice between these various sites? Are you a member of any of these services? Why or why not?

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