def resume(tournament): tournament_instance = Tournament() tournament_instance.id = tournament["id"], tournament_instance.name = tournament["name"], tournament_instance.players = tournament_instance.deserialized_player(tournament["players"]) tournament_instance.date = tournament["date"], tournament_instance.number_of_turns = tournament["number_of_turns"], tournament_instance.turns = tournament_instance.deserialize_turns(tournament["turns"]), tournament_instance.turns = tournament_instance.turns[0] tournament_instance.time_control = tournament["time_control"], tournament_instance.description = tournament["description"], return tournament_instance
def create_tournament(): tournament = Tournament() tournament.name = input("Enter tournament's name: ") tournament.place = input("Enter tournament's place: ") tournament.date = input("Enter tournament's date: ") tournament.time_control = input("Enter tournament's time_control: ") tournament.description = input("Enter tournament's description: ") players_list = [] for index in range(8): player_id = int(input("Enter the id of the player " + str(index + 1) + " for this tournament : ")) tournament.get_player_for_tournament(player_id, players_table, tournament) players_list = tournament.sort_players_by_rank(tournament) tournament.create(tournament, tournaments_table, players_list, players_table) create_turn(tournament) return tournament