diff --git a/play.py b/play.py index 773f7f3..843bbb3 100644 --- a/play.py +++ b/play.py @@ -3,12 +3,16 @@ from yahtzee_goals import ( GoalOnes, GoalTwos, GoalThrees, + GoalFours, + LargeStraight ) goals = [ GoalOnes(), GoalTwos(), GoalThrees(), + GoalFours(), + LargeStraight(), ] game = Yahtzee(goals) diff --git a/yahtzee_goals.py b/yahtzee_goals.py index 10af574..6016b9e 100644 --- a/yahtzee_goals.py +++ b/yahtzee_goals.py @@ -40,3 +40,29 @@ class GoalThrees: if die.face == 3: total += 3 return total + +class GoalFours: + "Four points for each four" + def prompt(self,dice): + potential_score = self.score(dice) + return f"Fours ({potential_score})" + def score(self,dice): + total = 0 + for die in dice: + if die.face == 4: + total += 4 + return total + +class LargeStraight: + "Fourty points for 5 sequential dice" + + def prompt(self, dice): + potential_score = self.score(dice) + return f"Large Straight ({potential_score})" + def score(self,dice): + total = 0 + faces = [die.face for die in dice] + if faces == [1,2,3,4,5] or faces == [2,3,4,5,6]: + total = 40 + return total +