当前位置: 首页>>代码示例>>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;未经允许,请勿转载。