Question: Please use MATLAB. runction Name: battleship Inputs: 1. (char) A 10x10 array representing player one's ship placement 2. (char) A 10x 10 array representing player

Please use MATLAB.
 Please use MATLAB. runction Name: battleship Inputs: 1. (char) A 10x10
array representing player one's ship placement 2. (char) A 10x 10 array

runction Name: battleship Inputs: 1. (char) A 10x10 array representing player one's ship placement 2. (char) A 10x 10 array representing player two's ship placement 3. (char) A comma separated list of moves Outputs 1. (char) A string describing the outcome of the game Background: You have always dreamed of being a pirate one day. In order to be a good pirate, you rain every day by playing your favorite game, Battleship. Now that you know iteration in MATLAB, you realize that you can become King of the Pirates with the power of MATLAB! Function Description Battleship is a two-player guessing game in which each player arranges a feet of ships on a 10x10 grid. The players then take turns guessing where on the grid the opponent's ships are located. The game ends when one player has "sunk all of the other player's ships by guessing every grid coordinate containing part of a ship. On the left, a typical battleship board is shown below, where ships are colored in blue. On the right is our MATLAB representation of the same board A B CDEFGHI 0 0 Given a list of moves and the game boards of both players, play out a game of battleship. The third input will be given in the form ,xp2 guess, turns. Example: pi p2 0 0 0 0 moves 'E3,H4,C2,E8,C3,CS,C4,IS,110,14,C4,D10,310,H9 winner battleship(pi, p2, moves) >'Player 1 won after 7 turns. Notes: There will always be a winner, but there may be more moves listed than are necessary to end the game. A turn consists of both players making a guess, unless the game ends after player one's guess. Players will never guess a square that is not on the grid Hints: The strtok function may be useful

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
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!