dice_player.py: Defines the DicePlayer class, which represents the player (and their computer opponent). It takes care...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
dice_player.py: Defines the DicePlayer class, which represents the player (and their computer opponent). It takes care of "rolling" the dice, keeping track of score, and updating both player's and opponent's scores based upon the roll. only file you will have to write code for is dice_player.py, in three of its methods: - present_scores: Write code to assign to the variable current_leader the String representing whichever player is ahead -- or "Actually, it's a tie (when the two scores are the same) final_scores: Same as the previous, for the variable winner. • do_roll: This is a complex method that will need to accomplish a number of things: 1. Announce that the player is rolling. (Already taken care of.) 2. Roll and get the values of each die - first and second - along with their difference (and sum, if needed.) 3. Announce what the player has rolled: the value of each die (in order) and the sum of the two. 4. Based on the values: Make a decision about how to update each player's score, make the updates, and announce the nature of the updates. (See the sample output below.) dice_player.py: Defines the DicePlayer class, which represents the player (and their computer opponent). It takes care of "rolling" the dice, keeping track of score, and updating both player's and opponent's scores based upon the roll. only file you will have to write code for is dice_player.py, in three of its methods: - present_scores: Write code to assign to the variable current_leader the String representing whichever player is ahead -- or "Actually, it's a tie (when the two scores are the same) final_scores: Same as the previous, for the variable winner. • do_roll: This is a complex method that will need to accomplish a number of things: 1. Announce that the player is rolling. (Already taken care of.) 2. Roll and get the values of each die - first and second - along with their difference (and sum, if needed.) 3. Announce what the player has rolled: the value of each die (in order) and the sum of the two. 4. Based on the values: Make a decision about how to update each player's score, make the updates, and announce the nature of the updates. (See the sample output below.)
Expert Answer:
Answer rating: 100% (QA)
Rhe diceplayerpy file that implements the DicePlayer class with the requested methods python import ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
(a) Identify FOUR advantages of finance companies over commercial banks regarding to business loan operations. (4 marks) (b) Identify and explain TWO reasons for increase in underwriting risk of life...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
KYC's stock price can go up by 15 percent every year, or down by 10 percent. Both outcomes are equally likely. The risk free rate is 5 percent, and the current stock price of KYC is 100. (a) Price a...
-
Let be an arbitrary operation in Problems 5259. Describe the operation for each problem. 5038; 70 2= 9; 901 = 10; 8 0 2 = 10; -
-
Sue and Sam Ristic own Club Fab. From its inception, Club Fab has sold merchandise on either a cash or credit basis, but no credit cards have been accepted. During the past several months, the...
-
If the curve y = f(x), a x b, is rotated about the horizontal line y = c, where f(x) c, find a formula for the area of the resulting surface.
-
What does Section 404 of the Sarbanes-Oxley Act of 2002 require? (a) A 10-year jail sentence and $1 million fine for violations of the act. (b) Rotation of audit partners every five years. (c) A...
-
In a recent year, the stockholders equity section of Aluminum Company of America (Alcoa) showed the following (in alphabetical order): additional paid-in capital $6,101, common stock $925, preferred...
-
A sleep study administered to U.S. adults showed that the amount of sleep (in hours) they get in a 24-hour period is normally distributed with a mean of 6.5 hours and a standard deviation of 1.25...
-
Show that the probability that the period of f(x)=a x mod M is odd is at most 1/2.
-
4. Suppose an investor forms a stock portfolio by investing $10,000 in Freeport-McMoran and $10,000 in Entergy Corp. a. What would be the portfolio's expected rate of return, standard deviation, and...
-
1. Write the equation of a line through (-1, 3) and it is (a) perpendicular to the line x+2y-8=0 (b) parallel to the line 3x-2y=1 (c) parallel to x-axis (d) parallel to y-axis 2. Prove that the...
-
Describe the difference between a global static variable and a global extern variable. If a variable is declared with an extern storage category, what other declaration statement must be present...
-
8. A triangular wheel is spun 5 times in a game of "Spin the Triangle" There are three different corners of the wheel consisting of "Yes," "No," and "Maybe." How many different outcomes are possible...
-
Accounting Question: Performed the work on the assignment and sent an invoice to the customer for $1,824. what increases assests, liablities or assests or decreases?
-
A fluorescent light bulb is only 15.0 % efficient. How much energy input would be required for the bulb to produce 252 J of light energy?
-
Chroma sub-sampling is widely used by many video recorders to remove color redundancies. Table 1 shows an array of raw video pixels before sub-sampling. Each pixel is represented by Y/Cb/Cr.
-
On August 31, 2012, the balances of the accounts appearing in the ledger of Wood Interiors Company, a furniture wholesaler, are as follows:Prepare the August 31, 2012, closing entries for Wood...
-
Which of the following statements is not true? a. It is possible for a widget to not be visible in the Content panel. b. The Hierarchy section displays a tree view representation of your layout. c....
-
Java is architecturally ____________. a. Neutral b. Oriented c. Specific d. Abstract
-
You cannot delete a path ____________. A. Under any circumstances B. If it represents a directory C. If it represents a directory that is not empty D. If it represents more than five levels
-
What role does the HAL play in the platform?
-
If your logic analyzer is capable of on-the-fly disassembly, use it to display bus activity in the form of instructions, rather than simply 1s and 0s.
-
Draw UML state diagrams for device 1 and device 2 in a four-cycle handshake.
Study smarter with the SolutionInn App