From 85c9dbd646a9d40384eda005cf0246a1ee01549a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sat, 20 May 2023 14:31:43 +0200 Subject: [PATCH] fix generation of links --- compress.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compress.py b/compress.py index 2663d76..87b5cf8 100755 --- a/compress.py +++ b/compress.py @@ -167,11 +167,11 @@ def decompress_deck(deck_str: str) -> List[DeckCard]: # otherwise compression is not possible def compress_game_state(state: Union[GameState, HanabLiveGameState]) -> str: var_id = -1 - if isinstance(state, GameState): - var_id = HanabLiveInstance.select_standard_variant_id(state.instance) - else: - assert isinstance(state, HanabLiveGameState) + if isinstance(state, HanabLiveGameState): var_id = state.instance.variant_id + else: + assert isinstance(state, GameState) + var_id = HanabLiveInstance.select_standard_variant_id(state.instance) out = "{}{},{},{}".format( state.instance.num_players, compress_deck(state.instance.deck), @@ -216,7 +216,7 @@ def decompress_game_state(game_str: str) -> GameState: except ValueError: raise ValueError("Expected variant id, found: {}".format(variant_id)) - instance = HanabiInstance(deck, num_players, variant_id=variant_id) + instance = HanabiInstance(deck, num_players) game = GameState(instance) # TODO: game is not in consistent state @@ -226,7 +226,7 @@ def decompress_game_state(game_str: str) -> GameState: def link(game_state: GameState) -> str: compressed = compress_game_state(game_state) - return "https://hanab.live/replay-json/{}".format(compressed) + return "https://hanab.live/shared-replay-json/{}".format(compressed) # add link method to GameState class