Fast Reliable 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 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 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 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 report it sunk 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 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