Question: Matlab Function Name: battleship 1. (ch A 10x 10anay present ng-one's ship placement 2. (char) A 10x 10 aray epresenting player two's ship placement (oha)
Matlab Function Name: battleship 1. (ch A 10x 10anay present ng-one's ship placement 2. (char) A 10x 10 aray epresenting player two's ship placement (oha) A comma separated ist of moves Outputs . (cha) A string describing the outcome of the game Background Tain every day by playing your favorite game, Batteship Now that you know oni You have aways dreamed of being a pirate one day. In ander to be a good prate you MATLAB, you reaize hat you can become King of the Praes with tthe power of MATLAB Function Description: on a 10 10 grid. The players then take urns guessing where on the grid the opponents shes Battieshp is a two-player guessing game in which each player arrangesafeet ofshis are located The game ends when one player has sunk all o the other player's ships by hown below, where ships ane colored in blu On the right is our MATLAB representation f the ame boand A BCDEFGHI Given ust or moves and the gane bo ot bot' puer% play 0 of bateship The thd input will be given in the lom p gssp2s ddnt win the game, mark player two's guess on player one's board Repeat his process un the game is over (when there ae no 's emaining on one of the player's boards) Finaly output the string Player ceo won after a turns Example: ovesE3,H4,C2,EB,3,CS,04,15,130,14,C4,010,33H9 winner batt leship(pi, p2,moves) Player 1 won after 7 turns There will aways be a winnet, but there may be more moves listed than ane necessary .A um consshs of both playes making a guess, unless the game ends ater player ones Players will never guess a square that is not on the grid The strtok function may be uselu
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
