Question: Matlab Program the game Battleship. The rough steps for this are as follows: A) Load the ship data file for the human and computer players
Matlab
Program the game Battleship. The rough steps for this are as follows: A) Load the ship data file for the human and computer players ships B) Use a nested loop structure that iterates between the human and computer player until the right number of hits is achieved for either player C) Use the following functions to keep your code modular a. A function to plot the playing field and ships b. A function to get the input from the human i. This function should get two values from the human, a letter and a number. Perform data checking and correction (for lower case letters, such that it repeats until the user enters two ENGR 131 ZZZ-90-100-01-B (Midterm Instructions) 2/25/2020 Page 2 of 3 Human's Ships valid choices. c. A function for the computer's selection that randomly guesses a space that has yet to be selected by it. d. A function to compare the player selection (human or computer) to the appropriate map e. A function to plot the hits and misses as appropriate. D) Be sure to show the computer's ships as shown. Yes, this is "cheating" but makes grading much easier. 0 1 2 3 4 5 6 7 8 9 10 11 Computer's Ships Hints: For the playing field, the field itself is 1-10, but to make it look right, you need to plot 0 to 11. 2 3 4 5 6 7 9 10 11 Play around with the label properties using set(gca,'Y TickLabels', {
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
Students Have Also Explored These Related Databases Questions!