diff --git a/src/hanabi/hanab_game.py b/src/hanabi/hanab_game.py index fcfb891..94c4a22 100644 --- a/src/hanabi/hanab_game.py +++ b/src/hanabi/hanab_game.py @@ -252,6 +252,21 @@ class GameState: self.clues -= 1 self._make_turn() + def make_action(self, action): + match action.type: + case ActionType.ColorClue | ActionType.RankClue: + assert self.clues > 0 + self.actions.append(action) + self.clues -= self.instance.clue_increment + self._make_turn() + # TODO: could check that the clue specified is in fact legal + case ActionType.Play: + self.play(action.target) + case ActionType.Discard: + self.discard(action.target) + case ActionType.EndGame | ActionType.VoteTerminate: + self.over = True + # Forward some properties of the underlying instance @property def num_players(self): diff --git a/src/hanabi/live/hanab_live.py b/src/hanabi/live/hanab_live.py index f548f78..633d273 100644 --- a/src/hanabi/live/hanab_live.py +++ b/src/hanabi/live/hanab_live.py @@ -125,21 +125,6 @@ class HanabLiveGameState(hanab_game.GameState): } } - def make_action(self, action): - match action.type: - case hanab_game.ActionType.ColorClue | hanab_game.ActionType.RankClue: - assert(self.clues > 0) - self.actions.append(action) - self.clues -= self.instance.clue_increment - self._make_turn() - # TODO: could check that the clue specified is in fact legal - case hanab_game.ActionType.Play: - self.play(action.target) - case hanab_game.ActionType.Discard: - self.discard(action.target) - case hanab_game.ActionType.EndGame | hanab_game.ActionType.VoteTerminate: - self.over = True - def _waste_clue(self) -> hanab_game.Action: for player in range(self.turn + 1, self.turn + self.num_players): for card in self.hands[player % self.num_players]: