Support taking general actions also in general game
This commit is contained in:
parent
d9afe3bff4
commit
daea750535
2 changed files with 15 additions and 15 deletions
|
@ -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):
|
||||
|
|
|
@ -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]:
|
||||
|
|
Loading…
Reference in a new issue