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

  Give examples of the gaps in public health policy

The HIV/AIDS epidemic has been a major driver of change for public health programs and public health policy. Never before has a single disease had such an enormous impact on global public health nor illustrated the gaps so vividly.

  Engage in deception on the internet

Every day we read stories of people who engage in deception on the internet, whether it is creating a dating profile which bears no likeness to what they really look like, or students who find information and pass it off as their own work.

  Violation of rules or procedures

Briefly give a summary of the three situations in your own words (do not simply cut and paste an article into the Discussion Board).

  Developing a teams emotional intelligence

Do you think it is appropriate for a leader to spend time developing a team's emotional intelligence (EI)?

  Which statistics would enable caryl to estimates

which of following statistics would enable Caryl to estimate probability that her bus will arrive within 5 minutes of its scheduled arrival time on any given day.

  Discuss scientific also technical concepts science

Discuss scientific also technical concepts related to materials science. Use manufacturing of one of following materials as basis for your response. Plastics, Glass also Metals.

  Analyze the biological-emotional-cognitive

which you analyze the biological, emotional, cognitive, and behavioral components of schizophrenia, psychosis, and lifespan development.

  Describe the universe on the solar system-stellar-galactic

Briefly describe the universe on the solar system, stellar, galactic, and intergalactic size scales

  Explain bombing of us marine barracks in lebanon

Bombing of U.S. marine barracks in Lebanon. Performed by militants who regarded U.S. military presents in Lebanon as the invasive influence in their civil war.

  Determine the rate heat is rejected

A refrigerator, with coils at 28 C operates with a coefficient performance of 4.0 and a power input of 0.8 kW. Heat is rejected from the surrounding air at 20 C. Determine a)the rate heat is rejected(kW), b)the lowest theoretical temp inside the refr..

  Relationship between foster care and becoming homeless

How are the needs of homeless youth similar to the needs of other homeless populations? In what ways are they different? Discuss the relationship between foster care (and aging out of foster care) and becoming homeless.

  Comparative aspects of these two religions

Identify a religion that you believe has the most in common with the teachings of Christianity. Explain your choice by discussing at least three comparative aspects of these two religions.

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