From 9f952c231f5a228acc3e997f8f1d79beae57c551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sat, 24 Jun 2023 17:23:05 +0200 Subject: [PATCH] download: support instances with some special options --- download_data.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/download_data.py b/download_data.py index e77e6c7..3affd68 100644 --- a/download_data.py +++ b/download_data.py @@ -42,6 +42,7 @@ def detailed_export_game(game_id: int, score: Optional[int] = None, var_id: Opti one_extra_card = options.get('oneExtraCard', False) one_less_card = options.get('oneLessCard', False) all_or_nothing = options.get('allOrNothing', False) + starting_player = options.get('startingPlayer', 0) actions = [Action.from_json(action) for action in game_json.get('actions', [])] deck = [DeckCard.from_json(card) for card in game_json.get('deck', None)] @@ -49,11 +50,18 @@ def detailed_export_game(game_id: int, score: Optional[int] = None, var_id: Opti assert seed is not None, assert_msg if score is None: - if deck_plays or one_less_card or one_extra_card or all_or_nothing: - # TODO: need to incorporate extra options here regarding hand size etc - raise RuntimeError('Not implemented.') # need to play through the game once to find out its score - game = HanabLiveGameState(HanabLiveInstance(deck, num_players, var_id)) + game = HanabLiveGameState( + HanabLiveInstance( + deck, num_players, var_id, + deck_plays=deck_plays, + one_less_card=one_less_card, + one_extra_card=one_extra_card, + all_or_nothing=all_or_nothing + ), + starting_player + ) + print(game.instance.hand_size, game.instance.num_players) for action in actions: game.make_action(action) score = game.score