MATLAB: Rock, Paper, Scissors in MATLAB

homework

In the attached document, looking at problem 4, how would I write the code using a matrix and while loop. I know how to write the code using many if statements, but I want some insight on how to use the matrix I created in a while loop. Im just looking for help, and not the answer given to me for my problem. Any help would be greatly appreciated. Thanks!

Best Answer

Here's a hint/snippet
gamesPlayed = 0
while gamesPlayed < 100 % Or whatever max you reasonably expect
% Other Code: menu(), randi(), etc.
% Increment the number of games played
gamesPlayed = gamesPlayed + 1;
promptMessage = sprintf('Do you want to Continue playing,\nor Quit?');
titleBarCaption = 'Continue?';
button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Quit', 'Continue');
if strcmpi(button, 'Quit')
break;
end
end
Related Question