Пример #1
0
 def serialization_copy(old_game):
     game_json = json.dumps(old_game, default=_save_object, indent=2)
     d = json.loads(game_json)
     game = Game.__from_json__(
         d, [player.agent for player in old_game.players])
     game._has_turn_ended = old_game._has_turn_ended
     return game
def deserialize(json_string, agents):
    """
    Decode the given game instance from a JSON formatted string.

    :param string json_string: The string representation of the game
    :rtype: :class:`hearthbreaker.game_objects.Game`
    """
    d = json.loads(json_string)
    return Game.__from_json__(d, agents)
Пример #3
0
def deserialize(json_string, agents):
    """
    Decode the given game instance from a JSON formatted string.

    :param string json_string: The string representation of the game
    :rtype: :class:`hearthbreaker.game_objects.Game`
    """
    d = json.loads(json_string)
    return Game.__from_json__(d, agents)
def _load_object(d):
    return Game.__from_json__(d)
 def serialization_copy(old_game):
     game_json = json.dumps(old_game, default=_save_object, indent=2)
     d = json.loads(game_json)
     return Game.__from_json__(d, [player.agent for player in old_game.players])
Пример #6
0
def _load_object(d):
    return Game.__from_json__(d)