Пример #1
0
def main():
    # set up our data
    # generate some players
    players = []
    for i in range(100):
        players.append(generate_player())

    # set up 6 teams
    teams = [
        Team('Chelsea'),
        Team('Man City'),
        Team('Arsenal'),
        Team('West Ham'),
        Team('Hull City'),
        Team('Swansea'),
    ]

    for team in teams:
        for player_num in range(11):
            # give them 11 starting players
            selected_player = random.choice(players)
            team.players.append(selected_player)
            players.remove(selected_player)

    # we have a single league
    first_league = League('Premiership League', teams, players)

    # create the manager
    manager = TeamManager(random.choice(teams), first_league)

    print('Season begins')
    for i in range(10):
        manager.manage()
        first_league.play_round()
    print('Season ends')
Пример #2
0
def main():
    # set up the data
    # set up 8 teams
    # only one manager per team
    # only one league

    players = []
    for i in range(100):
        players.append(generate_player())

    # more teams will be added later on
    teams = [
        Team('Toronto Raptors'),
        Team('Los Angeles Lakers'),
        Team('Houston Rockets'),
        Team("Golden State Warriors"),
        Team('Oklahoma City Thunder'),
        Team('Philadelphia 76ers'),
        Team('Portland Trail Blazers'),
        Team('Milwaukee Bucks')
    ]

    for team in teams:
        # give them 5 starting players
        for player_num in range(5):
            selected_player = random.choice(players)
            team.players.append(selected_player)
            players.remove(selected_player)

    # one league
    first_league = League('NBA')
    first_league.set_teams(teams)
Пример #3
0
def main():
    #set up our data
    #generate some players
    players = []
    for i in range(100):
        players.append(generate_player())

    #set up 5 teams
    teams = [
        Team('Patriots'),
        Team('Giants'),
        Team('Raiders'),
        Team('Steelers'),
        Team('Seahawks'),
        Team('Cowboys'),
    ]
    for team in teams:
        for player_num in range(11):

            #give them 11 starting players
            selected_player = random.choice(players)
            team.players.append(selected_player)
            players.remove(selected_player)

    #we have a single league
    first_league = League('National Football League', teams, players)

    # create the manager
    manager = TeamManager(random.choice(teams), first_league)

    print('Season begins')
    for i in range(10):
        manager.manage()
        first_league.play_round()
    print('Season ends')
Пример #4
0
def main():
    # Set Up

    # Generate some players
    players = []
    for i in range(100):
        players.append(generate_player())

    # Set up 5 teams
    teams = [
        Team("Chelsea"),
        Team("Man City"),
        Team("Arsenal"),
        Team("West Ham"),
        Team("Man Utd"),
        Team("Hull City"),
    ]

    # Giving players to team
    for team in teams:
        for player_num in range(11):
            selected_player = random.choice(players)
            team.players.append(selected_player)
            players.remove(selected_player)

    # We have a single league
    first_league = League("Premiership League", teams, players)
    first_league.set_teams(teams)

    # create the manager
    manager = TeamManager(random.choice(teams), first_league)

    print("Season begins...")
    for i in range(10):
        manager.manage()
        first_league.play_round()
    print("Season ends...")

    print("*" * 30)
    print("Your final score card.")
    manager.get_team_status()
    print("*" * 30)
Пример #5
0
def main():
    # generate some players
    players = []
    for i in range(100):
        players.append(generate_player())

    # set up the teams
    teams = [
        Team('chelsea'),
        Team('Man City'),
        Team('Hull City'),
        Team('West Hamy'),
        Team('Arsenal'),
        Team('Swansea')
    ]

    for team in teams:
        for player_num in range(11):
            # give the team some players
            selected_player = random.choice(players)
            team.players.append(selected_player)
            players.remove(selected_player)

    # create a manager
        manager = Team_Manager(random.choice(teams))

    # we have a single league
    first_league = League('Premiership League')
    first_league.add_teams(teams)

    print('season begins ')
    for i in range(10):
        first_league.play_round()
    print('Season ends')

    # print the players and teams and league
    for team in first_league.teams:
        print(team.name)
        for player in team.players:
            print(player.name),
        print("\n")
Пример #6
0
def main():
    # set up our data
    # generate some players, random(a couple hundred)
    fighters = []
    for i in range(100):
        fighters.append(generate_fighter())
    # set up 5 teams
    teams = [
        Team('Avengers'),
        Team('Annihilators'),
        Team('Black Panthers'),
        Team('Brute Force'),
        Team('Chaos'),
        Team('Full Atack')
    ]
    for team in teams:
        for fighter_num in range(5):
            # 5 fighters given from start at random
            selected_fighter = random.choice(fighters)
            team.fighters.append(selected_fighter)
            fighters.remove(selected_fighter)

    # create random fighters, create random managers(the player is one of those managers)
    first_league = League('Battle Zone', teams, fighters)
    first_league.set_teams(teams)

    # create the manager(player)
    manager = TeamManager(random.choice(teams), first_league)

    """
    play 10 rounds between all our teams
     """
    print('Tournament begins.')
    for i in range(10):
        manager.manage()
        first_league.play_round()
    print('Tournament ends.')