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


Python go.replay_position方法代码示例

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


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

示例1: extract_data

# 需要导入模块: import go [as 别名]
# 或者: from go import replay_position [as 别名]
def extract_data(self):
        assert len(self.searches_pi) == self.root.position.n
        assert self.result != 0
        for pwc, pi in zip(go.replay_position(self.root.position, self.result),
                           self.searches_pi):
            yield pwc.position, pi, pwc.result 
开发者ID:mlperf,项目名称:training_results_v0.5,代码行数:8,代码来源:strategies.py

示例2: test_replay_position

# 需要导入模块: import go [as 别名]
# 或者: from go import replay_position [as 别名]
def test_replay_position(self):
        sgf_positions = list(sgf_wrapper.replay_sgf(NO_HANDICAP_SGF))
        initial = sgf_positions[0]
        self.assertEqual(initial.result, go.WHITE)

        final = sgf_positions[-1].position.play_move(
            sgf_positions[-1].next_move)

        # sanity check to ensure we're working with the right position
        final_board = test_utils.load_board('''
            .OXX.....
            O.OX.X...
            .OOX.....
            OOOOXXXXX
            XOXXOXOOO
            XOOXOO.O.
            XOXXXOOXO
            XXX.XOXXO
            X..XOO.O.
        ''')
        expected_final_position = go.Position(
            final_board,
            n=62,
            komi=6.5,
            caps=(3, 2),
            ko=None,
            recent=tuple(),
            to_play=go.BLACK
        )
        self.assertEqualPositions(expected_final_position, final)
        self.assertEqual(final.n, len(final.recent))

        replayed_positions = list(go.replay_position(final, 1))
        for sgf_pos, replay_pos in zip(sgf_positions, replayed_positions):
            self.assertEqualPositions(sgf_pos.position, replay_pos.position) 
开发者ID:mlperf,项目名称:training_results_v0.5,代码行数:37,代码来源:test_go.py

示例3: test_replay_position

# 需要导入模块: import go [as 别名]
# 或者: from go import replay_position [as 别名]
def test_replay_position(self):
    sgf_positions = list(sgf_wrapper.replay_sgf(
        utils_test.BOARD_SIZE, NO_HANDICAP_SGF))
    initial = sgf_positions[0]
    self.assertEqual(initial.result, go.WHITE)

    final = sgf_positions[-1].position.play_move(
        sgf_positions[-1].next_move)

    # sanity check to ensure we're working with the right position
    final_board = utils_test.load_board('''
        .OXX.....
        O.OX.X...
        .OOX.....
        OOOOXXXXX
        XOXXOXOOO
        XOOXOO.O.
        XOXXXOOXO
        XXX.XOXXO
        X..XOO.O.
      ''')
    expected_final_position = go.Position(
        utils_test.BOARD_SIZE,
        final_board,
        n=62,
        komi=6.5,
        caps=(3, 2),
        ko=None,
        recent=tuple(),
        to_play=go.BLACK
    )
    self.assertEqualPositions(expected_final_position, final)
    self.assertEqual(final.n, len(final.recent))

    replayed_positions = list(go.replay_position(
        utils_test.BOARD_SIZE, final, 1))
    for sgf_pos, replay_pos in zip(sgf_positions, replayed_positions):
      self.assertEqualPositions(sgf_pos.position, replay_pos.position) 
开发者ID:itsamitgoel,项目名称:Gun-Detector,代码行数:40,代码来源:go_test.py

示例4: extract_data

# 需要导入模块: import go [as 别名]
# 或者: from go import replay_position [as 别名]
def extract_data(self):
    assert len(self.searches_pi) == self.root.position.n
    assert self.result != 0
    for pwc, pi in zip(go.replay_position(
        self.board_size, self.root.position, self.result), self.searches_pi):
      yield pwc.position, pi, pwc.result 
开发者ID:itsamitgoel,项目名称:Gun-Detector,代码行数:8,代码来源:strategies.py


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