class GoalOnes: "One point for each one" def prompt(self, dice): potential_score = self.score(dice) return f"Ones ({potential_score})" def score(self, dice): total = 0 for die in dice: if die.face == 1: total += 1 return total class GoalTwos: "Two points for each two" def prompt(self, dice): potential_score = self.score(dice) return f"Twos ({potential_score})" def score(self, dice): total = 0 for die in dice: if die.face == 2: total += 2 return total class GoalThrees: "Three points for each three" def prompt(self, dice): potential_score = self.score(dice) return f"Threes ({potential_score})" def score(self, dice): total = 0 for die in dice: 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 GoalFives: "Five points for each five" def prompt(self, dice): potential_score = self.score(dice) return f"Fives ({potential_score})" def score(self, dice): total = 0 for die in dice: if die.face == 5: total += 5 return total class GoalSixes: "Six points for each six" def prompt(self, dice): potential_score = self.score(dice) return f"Sixes ({potential_score})" def score(self, dice): total = 0 for die in dice: if die.face == 6: total += 6 return total class GoalThreeOfAKind: "Sum of all dice if three or more are the same" def prompt(self, dice): potential_score = self.score(dice) return f"Three of a Kind ({potential_score})" def score(self, dice): faces = [die.face for die in dice] for face in set(faces): if faces.count(face) >= 3: return sum(faces) return 0 class GoalFourOfAKind: "Sum of all dice if four or more are the same" def prompt(self, dice): potential_score = self.score(dice) return f"Four of a Kind ({potential_score})" def score(self, dice): faces = [die.face for die in dice] for face in set(faces): if faces.count(face) >= 4: return sum(faces) return 0 class GoalFullHouse: "25 points if three of one kind and two of another" def prompt(self, dice): potential_score = self.score(dice) return f"Full House ({potential_score})" def score(self, dice): faces = [die.face for die in dice] counts = {} for face in faces: counts[face] = counts.get(face, 0) + 1 if sorted(counts.values()) == [2, 3]: return 25 return 0 class GoalSmallStraight: "30 points for four consecutive numbers" def prompt(self, dice): potential_score = self.score(dice) return f"Small Straight ({potential_score})" def score(self, dice): faces = sorted(set([die.face for die in dice])) straights = [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6]] for straight in straights: if all(num in faces for num in straight): return 30 return 0 class GoalLargeStraight: "40 points for five consecutive numbers" def prompt(self, dice): potential_score = self.score(dice) return f"Large Straight ({potential_score})" def score(self, dice): faces = sorted([die.face for die in dice]) if faces == [1, 2, 3, 4, 5] or faces == [2, 3, 4, 5, 6]: return 40 return 0 class GoalYahtzee: "50 points if all five dice are the same" def prompt(self, dice): potential_score = self.score(dice) return f"Yahtzee ({potential_score})" def score(self, dice): faces = [die.face for die in dice] if len(set(faces)) == 1: return 50 return 0 class GoalChance: "Sum of all dice" def prompt(self, dice): potential_score = self.score(dice) return f"Chance ({potential_score})" def score(self, dice): return sum([die.face for die in dice])