Write a MATLAB script (craps.m) that plays the dice game Craps. The player begin
ID: 3762473 • Letter: W
Question
Write a MATLAB script (craps.m) that plays the dice game Craps. The player begins by throwing two standard 6-sided dice. If the sum of the dice is 7 or 11, the player wins. If the sum is 2, 3 or 12, the player loses. Otherwise, the sum becomes the player's point. The player continues to roll until either the point comes up again, in which case the player wins, or the player throws 7, in which case they lose. When playing the game, your program will show a visual representation of the two dice. Moreover, the only user input is pressing the key. Programming tips: Consider writing the Craps program without showing a visual representation of the two dice. Just show the two dice values as integers rst. Once your program is working at this level, go back and add the code for converting the integers of the dice into a visual representation. Finally, when writing the code for representing the dice visually, you might think about taking advantage of common drawing components among the dice. If you can find commonality among how the dice are drawn on the screen, you can reduce the amount of code written to solve the problem.
Explanation / Answer
Complete Program:
File: craps.m
Sample Output:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.