showing game scores for the game battleship wins and losses

1 次查看(过去 30 天)
i am writting the code for the game battleship and i want to be able to save the results of the gaem and in a diffretn case to show the wins and losses of player 1 and player 2 at the same time when the case is called for
  1 个评论
Rik
Rik 2022-1-5
Once you have written a game of battleship, saving to and loading from a mat file should be trivial. What have you tried?

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2022-1-5
num_player = 20;
WLT = zeros(num_player,3);
%...
if have_a_winner
WLT(winner_index,1) = WLT(winner_index,1) + 1;
WLT(loser_index,2) = WLT(loser_index,2) + 1;
else
WLT(player1_index,3) = WLT(player1_index,3) + 1;
WLT(player2_index,3) = WLT(player2_index,3) + 1;
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Board games 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by