當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。