Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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,
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.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Rhe diceplayerpy file that implements the DicePlayer class with the requested methods python import ...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