From bfc72c497d45466013d5dc407bec14c015793348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 2 Mar 2023 22:15:47 +0100 Subject: [PATCH] add action for voting to terminate the game --- compress.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compress.py b/compress.py index 4331c04..7f2eab6 100644 --- a/compress.py +++ b/compress.py @@ -47,6 +47,7 @@ class ActionType(Enum): ColorClue = 2 RankClue = 3 EndGame = 4 + VoteTerminate = 5 class Action(): @@ -57,7 +58,6 @@ class Action(): @staticmethod def from_json(action): - print("Converting {} to an action".format(action)) return Action( ActionType(action['type']), int(action['target']), @@ -72,17 +72,18 @@ class Action(): return "Discard card {}".format(self.target) case ActionType.ColorClue: return "Clue color {} to player {}".format(self.value, self.target) - case ActionType.ColorClue: + case ActionType.RankClue: return "Clue rank {} to player {}".format(self.value, self.target) case ActionType.EndGame: return "Player {} ends the game (code {})".format(self.target, self.value) - return "Undefined" + case ActionType.VoteTerminate: + return "Players vote to terminate the game" + return "Undefined action" def compress_actions(actions: List[Action]) -> str: minType = 0 maxType = 0 - print(actions) if len(actions) != 0: minType = min(map(lambda a: a.type.value, actions)) maxType = max(map(lambda a: a.type.value, actions))