Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Homework Help/Study Tips Expert

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.

Homework Help/Study Tips, Others

  • Category:- Homework Help/Study Tips
  • Reference No.:- M9862662

Have any Question?


Related Questions in Homework Help/Study Tips

Question please watch the videosbullsteered by the

Question: Please watch the videos: • Steered by the Unconscious - The unconscious brain picks up on sexual cues without you even being aware of it. Discussion Directions: What takes place in the subconscious which may in ...

Answer question 1 and 2 in at least 100 words each stating

Answer question 1 and 2 in at least 100 words each, stating one reference each. 1. Explain why it is important to conduct an intake interview before beginning the treatment phase of the case management process. What is s ...

Question 1 evaluate the patterns of behavior of early

Question: 1. Evaluate the patterns of behavior of early adapters versus followers. Determine the pattern of behavior that leads to a competitive advantage. Justify your response. 2. Give your opinion as to whether "Heat ...

Question how can knowledge of the abuse cycle assist you as

Question: How can knowledge of the abuse cycle assist you as a counselor to detect possible spousal abuse when providing couples counseling? Reference: Jackson-Cherry, L. R. &Erford, B. T. (2014).Crisis Assessment, Inter ...

Annotated bibliographyreview the research paper

Annotated Bibliography Review the Research Paper instructions found within the Research Paper link. The Research Paper is due in Week Five. To help with preparation, complete the following and submit to your instructor f ...

Question 1amiddot using the government accountability

Question 1a · Using the government accountability office, review the current organization and describe its organizational design model. · Using the government accountability office, identify a change that would help the ...

Question stereotypespart 1 the purpose of this assignment

Question: Stereotypes Part 1: The purpose of this assignment is to make you aware of your beliefs about being a victim. What happens in society at large in any group when the topic of victims arises? Use the technique of ...

Quesiton smart lab lessonsthe smartlab is a self-paced

Quesiton: Smart Lab Lessons The SMARTLab is a self-paced, online basic statistics course designed to prepare you for your graduate courses and graduate research. You will use the online primer in addition to this classro ...

Question evo-devo medical revolutions and human survivalfor

Question: "Evo-devo, Medical Revolutions and Human Survival" For your primary post, select ONE of the following discussion topics. Please select only one of the three topics listed. Using your own words, write a primary ...

First assignment- business ethics - assignmentwhat would

FIRST ASSIGNMENT- Business Ethics - Assignment What Would You Do? Read Decision Point: What Would You Do? pages 38 and 54 Scenario 1: You are the first person to arrive in your classroom and as you sit down you notice an ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As