make an array scoreboard for rock paper scissors game in matlab

main.m
% Initialize score array with zeros
score = zeros(2,1); %(2 players)

% Update scores based on game outcome
player1_won = true; % example, modify based on game outcome
if player1_won
    score(1) = score(1) + 1; % increase player 1 score
else
    score(2) = score(2) + 1; % increase player 2 score
end

% Display scores
disp(['Player 1 Score: ', num2str(score(1))]);
disp(['Player 2 Score: ', num2str(score(2))]);
414 chars
15 lines

related categories

gistlibby LogSnag