fix a few typos yielding errors
This commit is contained in:
parent
7aa8a78a9d
commit
a90423e5c4
1 changed files with 4 additions and 6 deletions
10
compress.py
10
compress.py
|
@ -57,7 +57,7 @@ def compress_actions(actions: List[Action], game_id=None) -> str:
|
||||||
|
|
||||||
|
|
||||||
def decompress_actions(actions_str: str) -> List[Action]:
|
def decompress_actions(actions_str: str) -> List[Action]:
|
||||||
if not len(actions_str >= 2):
|
if not len(actions_str) >= 2:
|
||||||
raise InvalidFormatError("min/max range not specified, found: {}".format(actions_str))
|
raise InvalidFormatError("min/max range not specified, found: {}".format(actions_str))
|
||||||
try:
|
try:
|
||||||
minType = int(actions_str[0])
|
minType = int(actions_str[0])
|
||||||
|
@ -99,7 +99,7 @@ def decompress_actions(actions_str: str) -> List[Action]:
|
||||||
if action_type in [ActionType.Play, ActionType.Discard]:
|
if action_type in [ActionType.Play, ActionType.Discard]:
|
||||||
if value is not None:
|
if value is not None:
|
||||||
raise InvalidFormatError(
|
raise InvalidFormatError(
|
||||||
"Invalid action value: Action at action index {} is Play/Discard, expected value None, found: {}".format(value)
|
"Invalid action value: Action at action index {} is Play/Discard, expected value None, found: {}".format(index, value)
|
||||||
)
|
)
|
||||||
target = BASE62.index(action[1])
|
target = BASE62.index(action[1])
|
||||||
return Action(action_type, target, value)
|
return Action(action_type, target, value)
|
||||||
|
@ -135,7 +135,7 @@ def decompress_deck(deck_str: str) -> List[DeckCard]:
|
||||||
maxRank = int(deck_str[1])
|
maxRank = int(deck_str[1])
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
raise InvalidFormatError(
|
raise InvalidFormatError(
|
||||||
"min/max rank range not specified, expected two integers, found {}".format(actions_str[:2])
|
"min/max rank range not specified, expected two integers, found {}".format(deck_str[:2])
|
||||||
) from e
|
) from e
|
||||||
if not maxRank >= minRank:
|
if not maxRank >= minRank:
|
||||||
raise InvalidFormatError(
|
raise InvalidFormatError(
|
||||||
|
@ -211,7 +211,7 @@ def decompress_game_state(game_str: str) -> GameState:
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise ValueError("Expected variant id, found: {}".format(variant_id))
|
raise ValueError("Expected variant id, found: {}".format(variant_id))
|
||||||
|
|
||||||
instance = HanabInstance(deck, num_players, variant_id=variant_id)
|
instance = HanabiInstance(deck, num_players, variant_id=variant_id)
|
||||||
game = GameState(instance)
|
game = GameState(instance)
|
||||||
|
|
||||||
# TODO: game is not in consistent state
|
# TODO: game is not in consistent state
|
||||||
|
@ -241,7 +241,5 @@ if __name__ == "__main__":
|
||||||
game.play(1)
|
game.play(1)
|
||||||
game.play(5)
|
game.play(5)
|
||||||
game.clue()
|
game.clue()
|
||||||
# a = compress_game_state(game)
|
|
||||||
# print(a)
|
|
||||||
print(game.link())
|
print(game.link())
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue