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

  What are some ways in which american society is stratified

What are some ways in which American society is stratified? What do you think the affect is on society when groups are stratified? This is a debate question that our SOC 120 is currently being discussed how would you answer this??

  Why did nibco decide to purchase an erp system

Why did NIBCO decide to purchase an ERP system? Why did it choose a Big Bang approach, rather than the 3-to-5 year plan suggested by the consulting firm? Describe the pros and cons of a Big Bang approach, versus a less risky rollout strategy. If you ..

  Did the founders think of the president as chief legislator

Did the Founders think of the president as chief legislator? Besides the State of the Union message and the veto, what legislative powers were granted to the president by the Constitution, if any?

  Series of numbers

What is the term for the value that occurs most often in a series of numbers?

  Duplicate values in an array

Write a program to display the duplicate values in an array.

  Traditional in talmudic scholarship-theology

Which of the following teaches the full following of the law or Torah and are very traditional in Talmudic scholarship, theology, forms of festival and worship?

  Supply chain management a logistics perspective

Supply Chain Management A logistics perspective. Case 3-1 Red Fish, Blue Fish, LLP: A Sequel 1. What are the advantages and potential disadvantages to Red Fish, Blue Fish of having China

  Key components of a good security policy

What are the key components of a good security policy? What are some of the most common attacks, and how can a network be protected against these attacks?

  What is the maximum step height

An open rectangular channel is 50 feet wide, flowing at a depth of 5 feet, and is carrying 1000 cubic feet per second. What is the maximum step height than can be placed into the flow without disturbing the upstream depth, without acting as a chok..

  Patient and caregiver roles matrix

Patients and caregivers may conform to a specific role during a health care visit. This usually happens because of cultural background or the upbringing of either the patient or the caregiver.

  Risks of a supply chain disruption

How single sourcing has become common due to the direct benefits...integrating operations to achieve rock bottom prices and just in time delivery. If your business chooses this path, what should you expect from your suppliers to minimize the risks of..

  Water vapor evaporating from pond-pressure for water

Water vapor evaporating from a pond does so as if it were diffusing across an air film 0.15 centimeters thick. The diffusion coefficient of water vapor in 20 degrees C air is about 0.25 cm^2/sec.

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