Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python and output should match the picture 3. (40 points) Write a simple game named MatchGame that uses a DiceShaker with two dice. For every
Python and output should match the picture
3. (40 points) Write a simple game named MatchGame that uses a DiceShaker with two dice. For every roll, if the face of the die are the same you get a point. MatchGame supports four methods: a. init__() takes no parameters. You will initialize and use an instance of DiceShaker that has two dice with 6 sides. b. roll() - shakes the DiceShaker and checks to see if you have rolled a match or not or not. It keeps track of the total rolls and the score. c. getRolls() - returns how many rolls have been done during the game so far. d.getScore() - returns the score of the game. >>> m=MatchGame () >>> m.roll() No match. No points. Die Values 1 6 >>> m.roll() No match. No points. Die Values 5 2 >>> m.roll() No match. No points. Die Values 5 4 >>> m.roll() No match. No points. Die Values 1 4 >>> m.roll() No match. No points. Die Values 4 3 >>> m. roll() No match. No points. Die Values 6 4 >>> m.roll() No match. No points. Die Values 6 3 >>> m.roll() Match! 1 point! Die Values: 6 6 >>> m.getScore () 1 >>> m.roll() No match. No points. Die Values 4 1 >>> m.roll() No match. No points. Die Values 5 1 >>> m.getRolls() 10Step 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