Navy vessels by guessing their locations on a grid

Assignment Help Other Subject
Reference no: EM13283324

Write a program to play a game in which you try to sink a fleet of five navy vessels by guessing their locations on a grid. The program uses random numbers to position its ships on a 15 X 15 grid. The ships are of different lengths as follows:

Frigate: 2 locations q  Tender: 2 locationsq  Destroyer: 3 locations,Cruiser: 3 locationsq  Carrier: 4 locations

The program must pick one square as the starting location, then pick the direction of the ship on the board and mark off the number of squares in that direction to represent the size of the ship. It must not allow a ship to overlap with another ship, or to run off the board.

The user enters coordinates in the range of 1 though 15 for the rows and A though 0 for the columns. The program checks this location, and reports whether it is a hit or a miss. If it is a hit, the program also checks whether the ship has been hit in every location that it occupies. If so, the ship is reported as sunk, and the program identifies which ship it is.

The user gets 60 shots to attempt to sink the fleet. If the user sinks all of the ships before using all 60 shots, then he or she wins the game. At the end of the game, the program should output the grid, so that the user can see where the shops are located.

Reference no: EM13283324

Questions Cloud

Use the internet to investigate the leadership style : Choose the CEO of one of the following organizations for this assignment: Google, Zappos, Southwest Airlines, Hewlett Packard, Xerox, W.L. Gore, DuPont, or Procter & Gamble. Use the Internet to investigate the leadership style and effectivenes..
Identify the optimal assignments and compute total minimum : Which salesperson should be assigned to each region to minimize total time? Identify the optimal assignments and compute total minimum time.
Differences in normal aging-primary aging-seconday aging : Describe the key differences between normal aging, primary aging, and secondary aging.  What control do we have over each of these processes, and how are they influenced by internal changes, external changes, and daily life exposures?  Reflect on the..
Build an organizational strategic plan : Strategic planning and the tradtional steps to build an organizational strategic plan
Navy vessels by guessing their locations on a grid : Write a program to play a game in which you try to sink a fleet of five navy vessels by guessing their locations on a grid. The program uses random numbers to position its ships on a 15 X 15 grid.
Deal-closing techniques : NOW THAT SHE HAD TO, JEAN M C GUIRE WASN'T sure she could. Not that she didn't understand what to do. Wright Boazman, sales director for Sunrise Land Developers, had made the step clear enough when he described a variety of effective "deal..
Write the class definition for a class named employee : Write the class definition for a class named Employee. The class should include data members for an employee object%u2019s name and salary. (The salary will be an integer). The class should contain two member functions: the constructor and a function..
Briefly discuss the issues around the use of repos : Briefly discuss the issues around the use of (and reliance on) repos by banks.
Hospitals and health systems : Debate the need for hospitals from the perspective in the early 1900s and in the 21st century. You are a health care professional looking to serve your community and you decided to open a hospital with a couple of individuals who want to provide this..

Reviews

Write a Review

Other Subject Questions & Answers

  Person’s level of autonomy affect their sense of freedom

How does a person’s level of autonomy affect their sense of freedom? How would a person, who aligns themselves with the incremental theory, view his or her sense of freedom differently from a person who aligns him or herself with the entity theory?

  Sources of proteins for our bodies

What are the sources of proteins for our bodies, and what are some of the functions that they have in our body, when they are at work during exercise?

  Women and the minorities in politics

What influence have women had on the politics in local, state and national government? What influence have other minorities had on the political landscape in local, state and national politics?

  Similarities-differences of glottochronology-dentochronology

Explain glottochronology, dentochronology, and dendrochronology, and write their similarities/differences. Give examples of these techniques are utilized.

  Explain common stereotypes about poverty

Explain common stereotypes about poverty. Examine some basic facts about low-income children. Who are the children which live in poverty?

  Literature search and review

Without using references, discuss how to go about doing a literature search. Include all details including keywords. How would you determine if a literature review was appropriate?

  How were earthquake intensities measured

How were earthquake intensities measured before the advent of the Richter Scale? What were the problems with that scale and how is the Richter scale far superior?

  Determine the feasibility of new theories-models

How should you determine the feasibility of new theories and models and their potential for long-term impacts on the healthcare system?

  Regulatory requirements on human resource process

Examination of the effect of legal, safety, and regulatory requirements on human resource process. Explanation of why the student does or does not agree with this statement: “Common sense and compassion in the workplace has been replaced by litigatio..

  Discuss the tenets of the social security act

Discuss the tenets of the social security act of 1935, including a critique of events and attitudes (from society and government) regarding the poor and the less fortunate that led to it's passage

  Dedication and commitment to the cause

How would you increase their dedication and commitment to this cause? How would you inspire them to continue to be involved in projects such as these?

  Effectiveness of aids vaccine

Describe the efficiency of AIDS vaccine. It must comprise information such as: the side effects of the vaccine, where do they use them the most

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