def load_from_json(dict): state = State(Deck.load_from_json(dict['deck']), dict['player1s_turn'], dict['p1_points'], dict['p2_points'], dict['p1_pending_points'], dict['p2_pending_points']) state.__phase = dict['phase'] state.__leads_turn = dict['leads_turn'] state.__revoked = dict['revoked'] return state
def load_from_json(dict): """ Creates a new state object from a JSON representation Output from convert_to_json function must be given to json.loads() before being handed to this function, as it is a string initially. Written for the user interface """ state = State(Deck.load_from_json(dict['deck']), dict['player1s_turn'], dict['p1_points'], dict['p2_points'], dict['p1_pending_points'], dict['p2_pending_points']) state.__phase = dict['phase'] state.__leads_turn = dict['leads_turn'] state.__revoked = dict['revoked'] return state