Question: Player class ( player . py ) has two attributes: a list of 3 Die objects and the player s points. 1 . _ _

Player class (player.py) has two attributes: a list of 3 Die objects and the players points.
1.__init__(self) constructs and sorts the list of three Die objects and initializes the
players points to 0.
2. get_points(self) returns the players points.
3. roll_dice(self) calls roll on each of the Die objects in the dice list and sorts the list.
4. has_pair(self) returns true if two dice in the list have the same value (uses ==).
Increments points by 1.
5. has_three_of_a_kind(self) returns true if all three dice in the list have the same
value (uses ==). Increments points by 3.
6. has_series(self) returns true if the values of each of the dice in the list are in a
sequence (ex.1,2,3 or 2,3,4 or 3,4,5 or 4,5,6)(uses -). Increments points by 2.
7.__str__(self) returns a string in the format: D1=2, D2=4, D3=6.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!