Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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() 10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

Students also viewed these Databases questions