showing game scores for the game battleship wins and losses

조회 수: 2 (최근 30일)
James Webber
James Webber 2022년 1월 5일
댓글: Walter Roberson 2022년 1월 5일
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에서 Strategy & Logic에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by