当前位置: 首页>>代码示例>>Python>>正文


Python go.PlayerMove方法代码示例

本文整理汇总了Python中go.PlayerMove方法的典型用法代码示例。如果您正苦于以下问题:Python go.PlayerMove方法的具体用法?Python go.PlayerMove怎么用?Python go.PlayerMove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在go的用法示例。


在下文中一共展示了go.PlayerMove方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_long_game_tree_search

# 需要导入模块: import go [as 别名]
# 或者: from go import PlayerMove [as 别名]
def test_long_game_tree_search(self):
        player = MCTSPlayerMixin(DummyNet())
        endgame = go.Position(
            board=TT_FTW_BOARD,
            n=MAX_DEPTH-2,
            komi=2.5,
            ko=None,
            recent=(go.PlayerMove(go.BLACK, (0, 1)),
                    go.PlayerMove(go.WHITE, (0, 8))),
            to_play=go.BLACK
        )
        player.initialize_game(endgame)

        # Test that an almost complete game
        for i in range(10):
            player.tree_search(num_parallel=8)
        self.assertNoPendingVirtualLosses(player.root)
        self.assertGreater(player.root.Q, 0) 
开发者ID:mlperf,项目名称:training_results_v0.5,代码行数:20,代码来源:test_strategies.py

示例2: test_passing

# 需要导入模块: import go [as 别名]
# 或者: from go import PlayerMove [as 别名]
def test_passing(self):
        start_position = Position(
            board=TEST_BOARD,
            n=0,
            komi=6.5,
            caps=(1, 2),
            ko=coords.from_kgs('A1'),
            recent=tuple(),
            to_play=BLACK,
        )
        expected_position = Position(
            board=TEST_BOARD,
            n=1,
            komi=6.5,
            caps=(1, 2),
            ko=None,
            recent=(PlayerMove(BLACK, None),),
            to_play=WHITE,
        )
        pass_position = start_position.pass_move()
        self.assertEqualPositions(pass_position, expected_position) 
开发者ID:mlperf,项目名称:training_results_v0.5,代码行数:23,代码来源:test_go.py

示例3: test_passing

# 需要导入模块: import go [as 别名]
# 或者: from go import PlayerMove [as 别名]
def test_passing(self):
        start_position = Position(
            board=TEST_BOARD,
            n=0,
            komi=6.5,
            caps=(1, 2),
            ko=pc('A1'),
            recent=tuple(),
            to_play=BLACK,
        )
        expected_position = Position(
            board=TEST_BOARD,
            n=1,
            komi=6.5,
            caps=(1, 2),
            ko=None,
            recent=(PlayerMove(BLACK, None),),
            to_play=WHITE,
        )
        pass_position = start_position.pass_move()
        self.assertEqualPositions(pass_position, expected_position) 
开发者ID:llSourcell,项目名称:alphago_demo,代码行数:23,代码来源:test_go.py

示例4: test_passing

# 需要导入模块: import go [as 别名]
# 或者: from go import PlayerMove [as 别名]
def test_passing(self):
    start_position = Position(
        utils_test.BOARD_SIZE,
        board=TEST_BOARD,
        n=0,
        komi=6.5,
        caps=(1, 2),
        ko=coords.from_kgs(utils_test.BOARD_SIZE, 'A1'),
        recent=tuple(),
        to_play=BLACK,
    )
    expected_position = Position(
        utils_test.BOARD_SIZE,
        board=TEST_BOARD,
        n=1,
        komi=6.5,
        caps=(1, 2),
        ko=None,
        recent=(PlayerMove(BLACK, None),),
        to_play=WHITE,
    )
    pass_position = start_position.pass_move()
    self.assertEqualPositions(pass_position, expected_position) 
开发者ID:itsamitgoel,项目名称:Gun-Detector,代码行数:25,代码来源:go_test.py

示例5: test_long_game_tree_search

# 需要导入模块: import go [as 别名]
# 或者: from go import PlayerMove [as 别名]
def test_long_game_tree_search(self):
    player = MCTSPlayerMixin(utils_test.BOARD_SIZE, DummyNet())
    endgame = go.Position(
        utils_test.BOARD_SIZE,
        board=TT_FTW_BOARD,
        n=MAX_DEPTH-2,
        komi=2.5,
        ko=None,
        recent=(go.PlayerMove(go.BLACK, (0, 1)),
                go.PlayerMove(go.WHITE, (0, 8))),
        to_play=go.BLACK
    )
    player.initialize_game(endgame)

    # Test that an almost complete game
    for i in range(10):
      player.tree_search(num_parallel=8)
    self.assertNoPendingVirtualLosses(player.root)
    self.assertGreater(player.root.Q, 0) 
开发者ID:itsamitgoel,项目名称:Gun-Detector,代码行数:21,代码来源:strategies_test.py

示例6: test_long_game_tree_search

# 需要导入模块: import go [as 别名]
# 或者: from go import PlayerMove [as 别名]
def test_long_game_tree_search(self):
        player = MCTSPlayer(DummyNet())
        endgame = go.Position(
            board=TT_FTW_BOARD,
            n=flags.FLAGS.max_game_length - 2,
            komi=2.5,
            ko=None,
            recent=(go.PlayerMove(go.BLACK, (0, 1)),
                    go.PlayerMove(go.WHITE, (0, 8))),
            to_play=go.BLACK
        )
        player.initialize_game(endgame)

        # Test that MCTS can deduce that B wins because of TT-scoring
        # triggered by move limit.
        for _ in range(10):
            player.tree_search(parallel_readouts=8)
        self.assertNoPendingVirtualLosses(player.root)
        self.assertGreater(player.root.Q, 0) 
开发者ID:mlperf,项目名称:training,代码行数:21,代码来源:test_strategies.py

示例7: test_passing

# 需要导入模块: import go [as 别名]
# 或者: from go import PlayerMove [as 别名]
def test_passing(self):
        start_position = Position(
            board=TEST_BOARD,
            n=0,
            komi=6.5,
            caps=(1, 2),
            ko=coords.from_gtp('A1'),
            recent=tuple(),
            to_play=BLACK,
        )
        expected_position = Position(
            board=TEST_BOARD,
            n=1,
            komi=6.5,
            caps=(1, 2),
            ko=None,
            recent=(PlayerMove(BLACK, None),),
            to_play=WHITE,
        )
        pass_position = start_position.pass_move()
        self.assertEqualPositions(pass_position, expected_position) 
开发者ID:mlperf,项目名称:training,代码行数:23,代码来源:test_go.py

示例8: test_move_with_capture

# 需要导入模块: import go [as 别名]
# 或者: from go import PlayerMove [as 别名]
def test_move_with_capture(self):
        start_board = test_utils.load_board(EMPTY_ROW * 5 + '''
            XXXX.....
            XOOX.....
            O.OX.....
            OOXX.....
        ''')
        start_position = Position(
            board=start_board,
            n=0,
            komi=6.5,
            caps=(1, 2),
            ko=None,
            recent=tuple(),
            to_play=BLACK,
        )
        expected_board = test_utils.load_board(EMPTY_ROW * 5 + '''
            XXXX.....
            X..X.....
            .X.X.....
            ..XX.....
        ''')
        expected_position = Position(
            board=expected_board,
            n=1,
            komi=6.5,
            caps=(7, 2),
            ko=None,
            recent=(PlayerMove(BLACK, coords.from_kgs('B2')),),
            to_play=WHITE,
        )
        actual_position = start_position.play_move(coords.from_kgs('B2'))
        self.assertEqualPositions(actual_position, expected_position) 
开发者ID:mlperf,项目名称:training_results_v0.5,代码行数:35,代码来源:test_go.py

示例9: test_translate_sgf_move

# 需要导入模块: import go [as 别名]
# 或者: from go import PlayerMove [as 别名]
def test_translate_sgf_move(self):
        self.assertEqual(
            ";B[db]",
            translate_sgf_move(go.PlayerMove(go.BLACK, (1, 3)), None))
        self.assertEqual(
            ";W[aa]",
            translate_sgf_move(go.PlayerMove(go.WHITE, (0, 0)), None))
        self.assertEqual(
            ";W[]",
            translate_sgf_move(go.PlayerMove(go.WHITE, None), None))
        self.assertEqual(
            ";B[db]C[comment]",
            translate_sgf_move(go.PlayerMove(go.BLACK, (1, 3)), "comment")) 
开发者ID:mlperf,项目名称:training_results_v0.5,代码行数:15,代码来源:test_sgf_wrapper.py

示例10: test_move

# 需要导入模块: import go [as 别名]
# 或者: from go import PlayerMove [as 别名]
def test_move(self):
        start_position = Position(
            board=TEST_BOARD,
            n=0,
            komi=6.5,
            caps=(1, 2),
            ko=None,
            recent=tuple(),
            to_play=BLACK,
        )
        expected_board = load_board('''
            .XX....OO
            X........
        ''' + EMPTY_ROW * 7)
        expected_position = Position(
            board=expected_board,
            n=1,
            komi=6.5,
            caps=(1, 2),
            ko=None,
            recent=(PlayerMove(BLACK, pc('C9')),),
            to_play=WHITE,
        )
        actual_position = start_position.play_move(pc('C9'))
        self.assertEqualPositions(actual_position, expected_position)

        expected_board2 = load_board('''
            .XX....OO
            X.......O
        ''' + EMPTY_ROW * 7)
        expected_position2 = Position(
            board=expected_board2,
            n=2,
            komi=6.5,
            caps=(1, 2),
            ko=None,
            recent=(PlayerMove(BLACK, pc('C9')), PlayerMove(WHITE, pc('J8'))),
            to_play=BLACK,
        )
        actual_position2 = actual_position.play_move(pc('J8'))
        self.assertEqualPositions(actual_position2, expected_position2) 
开发者ID:llSourcell,项目名称:alphago_demo,代码行数:43,代码来源:test_go.py

示例11: test_move_with_capture

# 需要导入模块: import go [as 别名]
# 或者: from go import PlayerMove [as 别名]
def test_move_with_capture(self):
        start_board = load_board(EMPTY_ROW * 5 + '''
            XXXX.....
            XOOX.....
            O.OX.....
            OOXX.....
        ''')
        start_position = Position(
            board=start_board,
            n=0,
            komi=6.5,
            caps=(1, 2),
            ko=None,
            recent=tuple(),
            to_play=BLACK,
        )
        expected_board = load_board(EMPTY_ROW * 5 + '''
            XXXX.....
            X..X.....
            .X.X.....
            ..XX.....
        ''')
        expected_position = Position(
            board=expected_board,
            n=1,
            komi=6.5,
            caps=(7, 2),
            ko=None,
            recent=(PlayerMove(BLACK, pc('B2')),),
            to_play=WHITE,
        )
        actual_position = start_position.play_move(pc('B2'))
        self.assertEqualPositions(actual_position, expected_position) 
开发者ID:llSourcell,项目名称:alphago_demo,代码行数:35,代码来源:test_go.py

示例12: test_move_with_capture

# 需要导入模块: import go [as 别名]
# 或者: from go import PlayerMove [as 别名]
def test_move_with_capture(self):
    start_board = utils_test.load_board(
        EMPTY_ROW * 5 + '''
        XXXX.....
        XOOX.....
        O.OX.....
        OOXX.....
        ''')
    start_position = Position(
        utils_test.BOARD_SIZE,
        board=start_board,
        n=0,
        komi=6.5,
        caps=(1, 2),
        ko=None,
        recent=tuple(),
        to_play=BLACK,
        )
    expected_board = utils_test.load_board(
        EMPTY_ROW * 5 + '''
        XXXX.....
        X..X.....
        .X.X.....
        ..XX.....
        ''')
    expected_position = Position(
        utils_test.BOARD_SIZE,
        board=expected_board,
        n=1,
        komi=6.5,
        caps=(7, 2),
        ko=None,
        recent=(PlayerMove(BLACK, coords.from_kgs(
            utils_test.BOARD_SIZE, 'B2')),),
        to_play=WHITE,)
    actual_position = start_position.play_move(coords.from_kgs(
        utils_test.BOARD_SIZE, 'B2'))
    self.assertEqualPositions(actual_position, expected_position) 
开发者ID:itsamitgoel,项目名称:Gun-Detector,代码行数:40,代码来源:go_test.py

示例13: test_move_with_capture

# 需要导入模块: import go [as 别名]
# 或者: from go import PlayerMove [as 别名]
def test_move_with_capture(self):
        start_board = test_utils.load_board(EMPTY_ROW * 5 + '''
            XXXX.....
            XOOX.....
            O.OX.....
            OOXX.....
        ''')
        start_position = Position(
            board=start_board,
            n=0,
            komi=6.5,
            caps=(1, 2),
            ko=None,
            recent=tuple(),
            to_play=BLACK,
        )
        expected_board = test_utils.load_board(EMPTY_ROW * 5 + '''
            XXXX.....
            X..X.....
            .X.X.....
            ..XX.....
        ''')
        expected_position = Position(
            board=expected_board,
            n=1,
            komi=6.5,
            caps=(7, 2),
            ko=None,
            recent=(PlayerMove(BLACK, coords.from_gtp('B2')),),
            to_play=WHITE,
        )
        actual_position = start_position.play_move(coords.from_gtp('B2'))
        self.assertEqualPositions(actual_position, expected_position) 
开发者ID:mlperf,项目名称:training,代码行数:35,代码来源:test_go.py

示例14: test_translate_sgf_move

# 需要导入模块: import go [as 别名]
# 或者: from go import PlayerMove [as 别名]
def test_translate_sgf_move(self):
        self.assertEqual(
            ";B[db]",
            translate_sgf_move(go.PlayerMove(go.BLACK, (1, 3))))
        self.assertEqual(
            ";W[aa]",
            translate_sgf_move(go.PlayerMove(go.WHITE, (0, 0))))
        self.assertEqual(
            ";W[]",
            translate_sgf_move(go.PlayerMove(go.WHITE, None))) 
开发者ID:yhyu13,项目名称:AlphaGOZero-python-tensorflow,代码行数:12,代码来源:test_sgf_wrapper.py


注:本文中的go.PlayerMove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。