I changed some code such as rolls and other things..

This commit is contained in:
mdecker6
2025-10-30 12:55:05 -04:00
parent a93273056f
commit 6ade1c83c7
3 changed files with 14 additions and 2 deletions

View File

@@ -20,8 +20,8 @@ class FiveDice:
return True
dice = FiveDice()
successes = 0
trials = 1000000
successes = 3
trials = 10
for trial in tqdm(range(trials)):
dice.roll()
if dice.all_ones():

1
die.py
View File

@@ -15,3 +15,4 @@ class Die:
def roll(self):
self.face = randint(1, 6)
return self.face

View File

@@ -109,3 +109,14 @@ class Yahtzee:
if die.face in choice_ints:
choice_ints.remove(die.face)
return len(choice_ints) == 0
def play(self):
"""Play an entire game.
Starts by greeting the user, then plays rounds until all the goals
have been used. When the game is over, tells the player their final
score.
"""
print("Welcome to Yahtzee!")
while self.count_unused_goals() > 0:
self.play_round()
print(f"Your final score was {self.score}")