Esempio n. 1
0
def test_game_amazons():
    from ggpzero.battle.amazons import MatchInfo
    match_info = MatchInfo()

    game_test("amazons_10x10", match_info.print_board, 3)
    game_test("amazons_10x10", match_info.print_board, 10)
    game_test("amazons_10x10", match_info.print_board, 16)
Esempio n. 2
0
def test_game_hex13():
    from ggpzero.battle.hex import MatchInfo
    match_info = MatchInfo(13)

    game_test("hexLG13", match_info.print_board, 3)
    game_test("hexLG13", match_info.print_board, 10)
    game_test("hexLG13", match_info.print_board, 16)
Esempio n. 3
0
    def test_move_gen(self):
        from ggpzero.battle.connect6 import MatchInfo

        match_info = MatchInfo()

        sm = match_info.game_info.get_sm()

        while True:
            moves = move_generator_c6()
            print "moves", moves
            if moves is not None:
                _, _, bs, _ = match_info.make_moves(moves)
                sm.update_bases(bs)
                match_info.print_board(sm)

            raw_input()
Esempio n. 4
0
    def connect6(self, filename="../data/elo/connect6.elo"):
        from ggpzero.battle.connect6 import MatchInfo

        match_info = MatchInfo()

        def dp(g, playouts, v):
            return define_player("connect6",
                                 g,
                                 playouts,
                                 v,
                                 max_dump_depth=1,
                                 dirichlet_noise_pct=0.15)

        # random = 500 elo
        random_player = get_player("r", MOVE_TIME)
        mcs_player = get_player("m", MOVE_TIME, max_iterations=800)
        simplemcts_player = get_player("s",
                                       MOVE_TIME,
                                       max_tree_playout_iterations=800)
        all_players = [random_player, mcs_player, simplemcts_player]

        man = manager.get_manager()

        num = 5
        gens = []
        while True:
            gen = "h1_%s" % num
            if not man.can_load("connect6", gen):
                break

            gens.append(gen)
            num += 10

        num = 145
        while True:
            gen = "h2_%s" % num
            if not man.can_load("connect6", gen):
                break

            gens.append(gen)
            num += 5

        gens += ["h1_183"]
        gens += [
            "h2_281", "h2_267", "h2_272", "h2_274", "h2_277", "h2_306",
            "h2_318", "h2_321"
        ]
        all_players += [dp(g, 800, 3) for g in gens]

        gen_elo(match_info,
                all_players,
                filename,
                move_generator=move_generator_c6)
Esempio n. 5
0
    def bt8(self, filename="../data/elo/bt8.elo"):
        from ggpzero.battle.bt import MatchInfo
        match_info = MatchInfo(8)

        def dp(g, playouts, v):
            return define_player("bt8", g, playouts, v,
                                 depth_temperature_stop=4,
                                 depth_temperature_start=4,
                                 random_scale=0.5)


        # 3 models ran on LG
        all_players = [dp(g, 800, 3) for g in ("x6_90", "x6_96", "x6_102", "x6_106", "x6_111",
                                               "x6_116", "x6_123", "x6_127", "x6_132", "x6_139",
                                               "x6_145", "x6_151", "x6_158", "x6_163", "x6_171",
                                               "x6_177")]

        kt_gens = ["kt1_1",
                   "kt1_2",
                   "kt1_3",
                   "kt1_4",
                   "kt1_5",
                   "kt1_7"]

        man = manager.get_manager()

        gens = []

        for name, num, incr in (["kt1", 10, 4],
                                ["kt3", 2, 3],
                                ["kt5", 2, 10],
                                ["f1", 1, 5],
                                ["az1", 2, 3]):
            while True:
                gen = "%s_%s" % (name, num)
                if not man.can_load("breakthrough", gen):
                    print "FAILED TO LOAD GEN", gen
                    break

                gens.append(gen)
                num += incr

        all_players += [dp(g, 800, 3) for g in gens]
        random_player = get_player("r", MOVE_TIME)
        mcs_player = get_player("m", MOVE_TIME, max_iterations=800)
        simplemcts_player = get_player("s", MOVE_TIME, max_tree_playout_iterations=800)
        all_players += [random_player, mcs_player, simplemcts_player]

        gen_elo(match_info, all_players, filename)
Esempio n. 6
0
    def hex11(self, filename="../data/elo/hex11.elo"):
        man = manager.get_manager()

        from ggpzero.battle.hex import MatchInfo
        match_info = MatchInfo(11)

        def dp(g, playouts, v):
            return define_player("hex11",
                                 g,
                                 playouts,
                                 v,
                                 dirichlet_noise_pct=0.15,
                                 depth_temperature_stop=4,
                                 depth_temperature_start=4,
                                 random_scale=0.9)

        gens = []
        for name, num, incr in (["h1", 5, 8], ["b1", 3, 5]):
            while True:
                gen = "%s_%s" % (name, num)
                if not man.can_load("hexLG11", gen):
                    print "FAILED TO LOAD GEN", gen
                    break

                gens.append(gen)
                num += incr

        all_players = [dp(g, 800, 3) for g in gens]

        random_player = get_player("r", MOVE_TIME)
        mcs_player = get_player("m", MOVE_TIME, max_iterations=800)
        simplemcts_player = get_player("s",
                                       MOVE_TIME,
                                       max_tree_playout_iterations=800)
        all_players += [random_player, mcs_player, simplemcts_player]

        gen_elo(match_info, all_players, filename)
Esempio n. 7
0
    def bt6(self, filename="../data/elo/bt6.elo"):
        man = manager.get_manager()

        from ggpzero.battle.bt import MatchInfo
        match_info = MatchInfo(6)

        def dp(g, playouts, v):
            return define_player("bt6", g, playouts, v,
                                 depth_temperature_stop=4,
                                 depth_temperature_start=4,
                                 random_scale=0.5)

        gens = []
        for name, num, incr in (["x1", 5, 8],
                                ["h2", 7, 8],
                                ["b1", 3, 5]):
            while True:
                gen = "%s_%s" % (name, num)
                if not man.can_load("breakthroughSmall", gen):
                    print "FAILED TO LOAD GEN", gen
                    break

                gens.append(gen)
                num += incr

        # 80 - all, 90 global
        gens += ["b1_80", "b1_90"]

        all_players = [dp(g, 800, 3) for g in gens]

        random_player = get_player("r", MOVE_TIME)
        mcs_player = get_player("m", MOVE_TIME, max_iterations=800)
        simplemcts_player = get_player("s", MOVE_TIME, max_tree_playout_iterations=800)
        all_players += [random_player, mcs_player, simplemcts_player]

        gen_elo(match_info, all_players, filename)
Esempio n. 8
0
def test_game_c6():
    from ggpzero.battle.connect6 import MatchInfo
    match_info = MatchInfo()
    game_test("connect6", match_info.print_board, 3)
    game_test("connect6", match_info.print_board, 10)