Simplify goals interface, remove .

This commit is contained in:
Chris Proctor 2024-11-10 14:10:35 -05:00
parent 88b65f75a9
commit 1d97a0df20
3 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
from yahtzee import Yachtzee
from yahtzee import Yahtzee
from yahtzee_goals import (
GoalOnes,
GoalTwos,
@ -11,5 +11,5 @@ goals = [
GoalThrees(),
]
game = Yachtzee(goals)
game = Yahtzee(goals)
game.play()

View File

@ -1,6 +1,6 @@
from die import Die
class Yachtzee:
class Yahtzee:
"""A command-line Yahtzee game.
This version of Yahtzee is initialized with a list of goals.
"""
@ -11,6 +11,9 @@ class Yachtzee:
def play(self):
print("Welcome to Yachtzee!")
self.score = 0
for goal in self.goals:
goal.used = False
while self.count_unused_goals() > 0:
self.play_round()
print(f"Your final score was {self.score}")

View File

@ -1,7 +1,6 @@
class GoalOnes:
"One point for each one"
used = False
def prompt(self, dice):
potential_score = self.score(dice)
@ -16,7 +15,6 @@ class GoalOnes:
class GoalTwos:
"Two points for each two"
used = False
def prompt(self, dice):
potential_score = self.score(dice)
@ -31,7 +29,6 @@ class GoalTwos:
class GoalThrees:
"Three points for each three"
used = False
def prompt(self, dice):
potential_score = self.score(dice)