generated from mwc/lab_dice
I edited the dice code to include 3 & 4 of a kind.
Checkpoint 1: I am not familiar with classes at all so I am still a little unsure of what I could implement this on. Maybe for things that need to run multiple times until it corresponds to a certain value... The first thing I can think of is hacking! Like in the movies the hackers run bunch of passwords until they find the right one, lol! Since we're also in the game unit, I remember there was these dressing up games that would score your outfit for certain events. I wonder if they utilized a similar thing where they went through various combinations that the players made and scored if they were matching (like three of a kind, etc.).
This commit is contained in:
@@ -18,6 +18,20 @@ class FiveDice:
|
|||||||
if face != 1:
|
if face != 1:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def is_three_of_a_kind(self):
|
||||||
|
for face in self.faces():
|
||||||
|
if self.faces.count(face) >= 3:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def is_four_of_a_kind(self):
|
||||||
|
for face in self.faces():
|
||||||
|
if self.faces.count(face) >= 4:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dice = FiveDice()
|
dice = FiveDice()
|
||||||
successes = 0
|
successes = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user