Beispiel #1
0
def setup_draft(dft):
    while True:
        setup_menu(dft)
        # choice tree
        choice = san.sanitize_int("Make a selection: ", 1, 8)
        if choice == 1:
            name = input("Enter the name of the draft: ")
            dft.change_name_of_draft(name)
        elif choice == 2:
            teams = san.sanitize_int("Enter the number of teams: ", 2, 32)
            dft.change_number_of_teams(teams)
        elif choice == 3:
            rounds = san.sanitize_int("Enter the number of rounds: ", 1, 99)
            dft.change_number_of_rounds(rounds)
        elif choice == 4:
            main_team_index = san.sanitize_int(
                'Enter what position you will draft in: ', 1,
                dft.number_of_teams) - 1
            dft.change_main_index(main_team_index)
        elif choice == 5:
            time = san.sanitize_int(
                "Enter the number seconds allowed per pick: ", 15, 3600)
            dft.adjust_time_per_pick(time)
        elif choice == 6:
            player_list = change_player_list()
            dft.change_player_set(player_list)
        elif choice == 7:
            bp_list = change_ballpark_list()
            dft.change_ballpark_set(bp_list)
        elif choice == 8:
            break
    return dft, main_team_index
Beispiel #2
0
def main_menu():
    print_main_menu()
    choice = sanatize.sanitize_int("Enter a selection: ", 1, 9)
    if choice == 1:
        confirm = input(
            'Are you sure, this will erase all data from the database.')
        if confirm.upper() == "Y" or confirm.upper() == "YES":
            install.install()
        else:
            print("Selection not confirmed, no changes made.")
    elif choice == 2:
        year = sanatize.sanitize_int("What Season Would you like to install:",
                                     1901, 2017)
        install.import_season(year)
    elif choice == 3:
        td.run_draft(d.Draft())
    elif choice == 4:
        print("Review Tournament Draft not yet created, try again.")
    elif choice == 5:
        print("Continue Saved Tournament Draft not yet created, try again.")
    elif choice == 6:
        print("League Draft not yet created, try again.")
    elif choice == 7:
        print("Review League Draft not yet created, try again.")
    elif choice == 8:
        print("Continue Saved League Draft not yet created, try again.")
    elif choice == 9:
        player_list = player.open_player_list('1911_test')
        players = player.load_players(player_list)
        for p in players:
            p.display_card()
        input()
Beispiel #3
0
def change_player_list():
    player_list_path = join(curdir(), 'data', 'player_lists')
    list_choices = [
        f for f in listdir(player_list_path)
        if isfile(join(player_list_path, f))
    ]
    for i in range(len(list_choices)):
        print('{:3}- {}'.format(i + 1,
                                list_choices[i][:-4].replace('_',
                                                             ' ').title()))
    choice = san.sanitize_int("Choose the player list you would like to use: ",
                              1, len(list_choices))
    return list_choices[choice - 1][:-4]
Beispiel #4
0
def change_ballpark_suggestions(dft, team_number):
    ballparks = [
        x for x in dft.draftable_object_list
        if x.object_type == 'B' and not x.drafted
    ]
    for b in ballparks:
        print('{} {}'.format(b.draft_id, b.dft_object.full_name))
    pick_id = san.sanitize_int('Select Ballpark to rate for:',
                               min([x.draft_id for x in ballparks]),
                               max([x.draft_id for x in ballparks]))
    ballpark_id = [
        x.dft_object.ballpark_id for x in ballparks if x.draft_id == pick_id
    ][0]
    dft.teams[team_number - 1].change_ballpark_suggestions(ballpark_id)
Beispiel #5
0
def select_team_names(dft):
    dft.setup_teams()
    team_names = []
    for i in range(dft.number_of_teams):
        team = 'Team #{}'.format(i + 1)
        team_names.append(team)
    while True:
        print("Team Names:")
        for i in range(len(team_names)):
            print('{:2}- {}'.format(i + 1, team_names[i]))
        choice = san.sanitize_int("Choose Team Name to Change (0 to end): ", 0,
                                  len(team_names))
        if choice == 0:
            break
        else:
            team_names[choice - 1] = input("Team {}: ".format(choice))
    return team_names