diff --git a/hanabi.py b/hanabi.py index 3fbe778..794f795 100644 --- a/hanabi.py +++ b/hanabi.py @@ -48,6 +48,9 @@ class Action(): self.type = type_ self.target = target self.value = value + # enforce no values on play / discard + if self.type in [ActionType.Discard, ActionType.Play]: + self.value = None @staticmethod def from_json(action): @@ -73,6 +76,9 @@ class Action(): return "Players vote to terminate the game (code {})".format(self.value) return "Undefined action" + def __eq__(self, other): + return self.type == other.type and self.target == other.target and self.value == other.value + class HanabiInstance(): def __init__(