本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)