create array scoreboard for rock paper scissors game using table lookup in matlab

main.m
% Create a 3x3 matrix to represent the scoreboard for Rock-Paper-Scissors game
% Rows represent the user's choice (1=Rock, 2=Paper, 3=Scissors)
% Columns represent the computer's choice
% Each cell in the matrix will contain the result of the game (1=Win, 0=Tie, -1=Loss)

scoreboard = [
    0  -1  1;  % User chose Rock
    1   0 -1;  % User chose Paper
    -1  1  0   % User chose Scissors
];

% Display the scoreboard
disp('Scoreboard for Rock-Paper-Scissors game:');
disp('    Computer:');
disp('User  Rock   Paper   Scissors');
disp(scoreboard);
551 chars
17 lines

related categories

gistlibby LogSnag