本文整理匯總了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)