Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB - Write code to perform a complete game of Yahtzee in MATLAB The program should be able to do the following: 1. roll five
MATLAB - Write code to perform a complete game of Yahtzee in MATLAB
The program should be able to do the following: 1. roll five dice up to three times, permitting the player to select which dice to keep between each roll; 2. ask the player if they wish to roll again, or score the roll; 3. when the turn is complete, ask the player which entry they wish to make in their score sheet (e.g., ones, twos, ... full house, small straight, large straight... etc.); 4. determine if the player can make the entry they selected (e.g., if the player ends with 1, 2, 3, 4, 6 and asks to take a large straight, the program should tell them they do not have the dice make that entry, and ask again. Alternatively, the program can identify which rolls the player can take and advise them accordingly.); 5. recognize when each entry in the yahtzee score sheet has been filled, and deny a player from making a redundant entry (except for a yahtzee, which adds 100 to the score for each subsequent yahtzee rolled); 6. print the score sheet to the screen showing all scores tallied after each roll; 7. identify when the game has ended and print the final score sheet, announcing the game has endedStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started