diff --git a/play.py b/play.py index a8e683c..773f7f3 100644 --- a/play.py +++ b/play.py @@ -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() diff --git a/yahtzee.py b/yahtzee.py index 8ae2b41..69b0e97 100644 --- a/yahtzee.py +++ b/yahtzee.py @@ -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}") diff --git a/yahtzee_goals.py b/yahtzee_goals.py index fce4e5a..10af574 100644 --- a/yahtzee_goals.py +++ b/yahtzee_goals.py @@ -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)