Fast Reliable And (3b) Test For Game Over (all Boats Sunk). Repeat The Loop Until Done; Report The Number Of Shots Made By The User. Design Decision: Grid Array – A Answers.
Questions, Assignments & Papers. Get Answers from Premium Tutors.
Register Free Account
Receive help quickly. Choose your own delivery time.
Make questions 100% private & anonymous.
Get quality help from verified tutors.
TOP AND (3B) TEST FOR GAME OVER (ALL BOATS SUNK). REPEAT THE LOOP UNTIL DONE; REPORT THE NUMBER OF SHOTS MADE BY THE USER. DESIGN DECISION: GRID ARRAY – A QUESTIONS
visibility_off Private questions are not visible.
Program 5: Battleship: This program is a one-player version which enables a user to play Battleship with the computer; it will be written as a class g the class examined some of the algorithm steps needed. Initial Set-up: the computer needs a 10 by 10 “ocean” grid storing where its boats are found. E or the computer could read in data for its ocean grid. User communication: Software should be user-friendly. The user refers to a grid square using a March 30 and a column index from 0 to 9. We will write a function maybe void location(char ch int num int& row int& col) which will convert user input to the needed array index values. Before the user inputs a shot (fires a torpedo) the user sees the 10x10 ocean grid with each square showing either ocean a missed shot or a previous hit. The hit square tells which type of ship (1-boat 2-boat 3- boat 4-boat or 5-boat) was hit there. The primary loop: (1) User inputs grid square where torpedo is sent. Increment number of shots. (2) Hit or miss: If it is a tell the user and designate the miss in the grid. (3) If it is a hit tell the user which boat was hit and designate the hit for that boat in the grid. (3a) Test whether the boat was sunk (all positions have been hit); i report it sunk the class decided to use the following data structures for the project. There will be two parallel arrays for the 10x10 ocean grids: (1) The computer’ the code for “ocean”. The 1-boat position will be an element with the integer 1 in it; the 2-boat position will be two adjacent elements with a 2 in t