Ejemplo n.º 1
0
def run(log_dir, episodes, rounds):
    model_path = log_dir + '/rl1_model.h5'
    rl_player = RLPlayer(name='RL1', model_path=model_path, rounds=rounds)
    players = [
        rl_player,
        ChallengePlayer(name='Tick'),
        ChallengePlayer(name='Trick'),
        ChallengePlayer(name='Track')
    ]
    players = [
        rl_player,
        GreedyPlayer(name='Tick'),
        GreedyPlayer(name='Trick'),
        GreedyPlayer(name='Track')
    ]
    sum_won = 0
    for e in range(episodes):
        tournament = Tournament()
        [tournament.register_player(player) for player in players]
        tournament.play(rounds=rounds, use_counting_factor=False)
        rl_player.replay()
        sum_won += rl_player.won[0]
        print_stats_winning(rl_player.won_stich, rl_player.won, e, sum_won)
        rl_player.reset_stats()
    rl_player.model.save(model_path)
Ejemplo n.º 2
0
def test_greedy():
    players = [
        GreedyPlayer(name='Greedy1'),
        RandomPlayer(name='Track'),
        GreedyPlayer(name='Greedy2'),
        RandomPlayer(name='Track')
    ]
    run_statistics(players=players)
Ejemplo n.º 3
0
def test_sl1338hc_vs_greedy(sl1338_hc_model_path):
    players = [
        SLPlayer1338hc(name='SLPlayer1', game_model_path=sl1338_hc_model_path),
        GreedyPlayer(name='Greedy1'),
        SLPlayer1338hc(name='SLPlayer1', game_model_path=sl1338_hc_model_path),
        GreedyPlayer(name='Greedy2')
    ]
    get_function_name()
    run_game(players)
Ejemplo n.º 4
0
def test_challenge():
    players = [
        ChallengePlayer(name='Trick1'),
        GreedyPlayer(name='Greedy1'),
        ChallengePlayer(name='Trick2'),
        GreedyPlayer(name='Greedy2')
    ]

    run_statistics(players=players)
Ejemplo n.º 5
0
def test_sl_3lp_222_vs_greedy(sl3lp222_model_path):
    players = [
        SLPlayer3LP222(name='SLPlayer1', game_model_path=sl3lp222_model_path),
        GreedyPlayer(name='Greedy1'),
        SLPlayer3LP222(name='SLPlayer2', game_model_path=sl3lp222_model_path),
        GreedyPlayer(name='Greedy2')
    ]
    get_function_name()
    run_game(players)
def test_greedy_vs_challenge():
    players = [
        GreedyPlayer(name='GreedyPlayer1'),
        ChallengePlayer(name='ChallengePlayer1'),
        GreedyPlayer(name='GreedyPlayer2'),
        ChallengePlayer(name='ChallengePlayer2')
    ]
    get_function_name()
    run_game(players)
def test_greedy_vs_random():
    players = [
        GreedyPlayer(name='Greedy1'),
        RandomPlayer(name='Random1'),
        GreedyPlayer(name='Greedy2'),
        RandomPlayer(name='Random2')
    ]
    get_function_name()
    run_game(players)
def test_greedy_vs_greedy():
    players = [
        GreedyPlayer(name='Greedy1'),
        GreedyPlayer(name='Greedy2'),
        GreedyPlayer(name='Greedy3'),
        GreedyPlayer(name='Greedy4')
    ]
    get_function_name()
    run_game(players)
def test_rl_vs_greedy(weights_directory):
    model_path = weights_directory + 'rl1_model.h5'
    players = [
        RLPlayer(name='RLPlayer1', model_path=model_path),
        GreedyPlayer(name='Greedy1'),
        RLPlayer(name='RLPlayer2', model_path=model_path),
        GreedyPlayer(name='Greedy2')
    ]
    get_function_name()
    run_game(players)
Ejemplo n.º 10
0
def run(log_dir, episodes, rounds):
    save_model_path = log_dir + '/sl1_model.h5'
    trumpf_model_path = log_dir + '/trumpf_network_model_final__2018-06-18_112248.h5'
    game_model_path = log_dir + '/Supervised_Gamenetwork__network_model_282__2018-09-02_122529.h5'
    sl_player = SLPlayer3LP222(name='SL1', game_model_path=game_model_path, trumpf_model_path=trumpf_model_path, rounds=rounds)
    # players = [sl_player, ChallengePlayer(name='Tick'), ChallengePlayer(name='Trick'), ChallengePlayer(name='Track')]
    players = [sl_player, GreedyPlayer(name='Tick'), GreedyPlayer(name='Trick'), GreedyPlayer(name='Track')]
    sum_won = 0
    for e in range(episodes):
        tournament = Tournament()
        [tournament.register_player(player) for player in players]
        tournament.play(rounds=rounds, use_counting_factor=False)
        sum_won += sl_player.won[0]
        print_stats_winning(sl_player.won_stich, sl_player.won, e, sum_won)
        sl_player.reset_stats()
Ejemplo n.º 11
0
def launch(server_address, session_name):
    opponents = [
        ServerPlayer(pyschieber_bot=GreedyPlayer(name='Greedy1'), server_address=server_address,
                     chosen_team_index=1, session_name=session_name),
        ServerPlayer(pyschieber_bot=GreedyPlayer(name='Greedy2'), server_address=server_address,
                     chosen_team_index=1, session_name=session_name)
    ]

    for opponent in opponents:
        process = Process(target=opponent.start)
        process.start()

    teammate = GreedyPlayer(name='Greedy Teammate')
    server_player = ServerPlayer(pyschieber_bot=teammate, server_address=server_address,
                                 session_name=session_name)
    server_player.start()
Ejemplo n.º 12
0
def start_tournament(points):
    tournament = Tournament(point_limit=points)

    players = [
        RandomPlayer(name='Tick'),
        RandomPlayer(name='Trick'),
        ChallengePlayer(name='Track'),
        GreedyPlayer(name='Dagobert')
    ]

    [tournament.register_player(player) for player in players]

    tournament.play()
Ejemplo n.º 13
0
def test_against_greedy():
    players = [PPOPlayer(name='PPO1'), GreedyPlayer(name='Greedy1'), PPOPlayer(name='PPO2'),
               GreedyPlayer(name='Greedy2')]
    run_statistics(players=players)