當前位置: 首頁>>代碼示例>>Python>>正文


Python sgf_wrapper.make_sgf方法代碼示例

本文整理匯總了Python中sgf_wrapper.make_sgf方法的典型用法代碼示例。如果您正苦於以下問題:Python sgf_wrapper.make_sgf方法的具體用法?Python sgf_wrapper.make_sgf怎麽用?Python sgf_wrapper.make_sgf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sgf_wrapper的用法示例。


在下文中一共展示了sgf_wrapper.make_sgf方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_make_sgf

# 需要導入模塊: import sgf_wrapper [as 別名]
# 或者: from sgf_wrapper import make_sgf [as 別名]
def test_make_sgf(self):
    all_pwcs = list(replay_sgf(utils_test.BOARD_SIZE, NO_HANDICAP_SGF))
    second_last_position, last_move, _ = all_pwcs[-1]
    last_position = second_last_position.play_move(last_move)

    back_to_sgf = make_sgf(
        utils_test.BOARD_SIZE,
        last_position.recent,
        last_position.score(),
        komi=last_position.komi,
    )
    reconstructed_positions = list(replay_sgf(
        utils_test.BOARD_SIZE, back_to_sgf))
    second_last_position2, last_move2, _ = reconstructed_positions[-1]
    last_position2 = second_last_position2.play_move(last_move2)

    self.assertEqualPositions(last_position, last_position2) 
開發者ID:itsamitgoel,項目名稱:Gun-Detector,代碼行數:19,代碼來源:sgf_wrapper_test.py

示例2: to_sgf

# 需要導入模塊: import sgf_wrapper [as 別名]
# 或者: from sgf_wrapper import make_sgf [as 別名]
def to_sgf(self, use_comments=True):
        assert self.result_string is not None
        pos = self.root.position
        if use_comments:
            comments = self.comments or ['No comments.']
            comments[0] = ("Resign Threshold: %0.3f\n" %
                           self.resign_threshold) + comments[0]
        else:
            comments = []
        return sgf_wrapper.make_sgf(pos.recent, self.result_string,
                                    white_name=os.path.basename(
                                        self.network.save_file) or "Unknown",
                                    black_name=os.path.basename(
                                        self.network.save_file) or "Unknown",
                                    comments=comments) 
開發者ID:mlperf,項目名稱:training_results_v0.5,代碼行數:17,代碼來源:strategies.py

示例3: test_make_sgf

# 需要導入模塊: import sgf_wrapper [as 別名]
# 或者: from sgf_wrapper import make_sgf [as 別名]
def test_make_sgf(self):
        all_pwcs = list(replay_sgf(NO_HANDICAP_SGF))
        second_last_position, last_move, _ = all_pwcs[-1]
        last_position = second_last_position.play_move(last_move)

        back_to_sgf = make_sgf(
            last_position.recent,
            last_position.score(),
            komi=last_position.komi,
        )
        reconstructed_positions = list(replay_sgf(back_to_sgf))
        second_last_position2, last_move2, _ = reconstructed_positions[-1]
        last_position2 = second_last_position2.play_move(last_move2)

        self.assertEqualPositions(last_position, last_position2) 
開發者ID:mlperf,項目名稱:training_results_v0.5,代碼行數:17,代碼來源:test_sgf_wrapper.py

示例4: test_make_sgf

# 需要導入模塊: import sgf_wrapper [as 別名]
# 或者: from sgf_wrapper import make_sgf [as 別名]
def test_make_sgf(self):
        all_positions = list(replay_sgf(NO_HANDICAP_SGF))
        last_position, _, metadata = all_positions[-1]
        back_to_sgf = make_sgf(
            last_position.recent,
            last_position.score(),
            boardsize=metadata.board_size,
            komi=last_position.komi,
        )
        reconstructed_positions = list(replay_sgf(back_to_sgf))
        last_position2, _, _ = reconstructed_positions[-1]

        self.assertEqualPositions(last_position, last_position2) 
開發者ID:llSourcell,項目名稱:alphago_demo,代碼行數:15,代碼來源:test_sgf_wrapper.py

示例5: to_sgf

# 需要導入模塊: import sgf_wrapper [as 別名]
# 或者: from sgf_wrapper import make_sgf [as 別名]
def to_sgf(self, use_comments=True):
    assert self.result_string is not None
    pos = self.root.position
    if use_comments:
      comments = self.comments or ['No comments.']
      comments[0] = ('Resign Threshold: %0.3f\n' %
                     self.resign_threshold) + comments[0]
    else:
      comments = []
    return sgf_wrapper.make_sgf(
        self.board_size, pos.recent, self.result_string,
        white_name=os.path.basename(self.network.save_file) or 'Unknown',
        black_name=os.path.basename(self.network.save_file) or 'Unknown',
        comments=comments) 
開發者ID:itsamitgoel,項目名稱:Gun-Detector,代碼行數:16,代碼來源:strategies.py


注:本文中的sgf_wrapper.make_sgf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。