Reference no: EM132206481
Write a MATLAB program to simulate the Stuck in the Mud game that can:
1. Use five (5) 6-sided dice to play the Stuck in the Mud game for any player, from rolling five (5) dice to all five (5) dice stuck in the mud.
2. Generate five (5) random integers between 1 and 6 to represent the face value of rolling five dice.
3. Print the five (5) dice values on screen.
4. Check for 2s and 5s from this roll. If the roll contains any 2 or 5, no points for this throw.
5. If there is no 2s or 5s, add up the total dice value to be the score of this roll.
6. Set aside any 2s and 5s.
7. Print any stuck in the mud dice values on screen.
8. Print the game score on screen.
9. Print the number of dice stuck in the mod on screen for tracking.
10. Throw the remaining dice.
11. Print the remaining dice values on screen.
12. If the remaining dice contain any 2s or 5s, no score for this throw.
13. Throws without 2s and 5s are added to the previous score.
14. Set aside any new 2s and 5s with the existing 2s and 5s.
15. Print all the currently stuck in the mud dice values on screen.
16. Print the game score on screen.
17. Print the number of dice stuck on screen.
18. Repeat steps 10 through 17 until all five (5) dice are stuck in the mud.
19. Add code to track the number of rolls automatically played for the player.
20. Add a print statement to indicate when a throw happens with the roll number.
The finished program can look like the following example. Extra components are always welcome.
ROLL 1
Rolling: 1 3 1 2 1
Stuck in the mud: 2
Game score: 0
Number of dice stuck: 1
ROLL 2
Rolling: 1 2 2 1
Stuck in the mud: 2 2 2
Game score: 0
Number of dice stuck: 3
ROLL 3
Rolling: 5 3
Stuck in the mud: 5 2 2 2
Game score: 0
Number of dice stuck: 4
ROLL 4
Rolling: 5
Stuck in the mud: 5 2 2 2 5
Game score: 0
Number of dice stuck: 5