Here's an example of how to simulate Yahtzee using a while loop in MATLAB:
main.m1163 chars46 lines
This code rolls 5 dice and checks for various Yahtzee combinations. If a combination is found, the loop exits and displays the score. Otherwise, the user is prompted to roll again (up to a maximum of 3 rolls).
gistlibby LogSnag