Question: Write a MATLAB program to simulate the Beat That! game that can: Use three ( 3 ) 6 - sided dice to play the game
Write a MATLAB program to simulate the Beat That! game that can:
Use three sided dice to play the game between a player and a computer.
Greet the player and briefly explain how to play the game when the game starts
Allow the player to press any key on the keyboard then hit the Enter key to play Press or then hit the Enter key to quit Directly hitting the Enter key to play is optional.
Generate three random integers between and to represent the face value of rolling three dice.
Roll three dice for the player and print the three dice values on screen
Roll three dice for the computer and print the three dice values on screen
Sort the player's dice values in acceding or descending order For example, a roll of and can be sorted to and
Sort the computer's dice values in acceding or descending order
Compute the best value rolled for the player For example, the sorted values of and can be combined into
Compute the best value rolled for the computer
Print the player's best value on screen
Print the computer's best value on screen
Compare the player's best value and the computer's best value and select a winner It is also possible that the match is a tie.
Print the match result on screen For example, the player wins, the computer wins, or the match ends in a tie.
Allow the player to press any key on the keyboard then hit the Enter key to play and press or then hit the Enter key to quit again. The game should allow the player to play one round after another without any preset value to limit the total number of rounds the player can play
Track the game statistics. Count the total number of rounds being played the number of rounds the player won the number of rounds the computer won and the number of rounds ended in ties
When the player decides to press or to quit playing, the game should end Greet the player farewell and print the total number of rounds played the number of rounds the player won the number of rounds the computer won and the number of rounds ended in ties on screen
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
