本文整理汇总了Python中go.is_eyeish方法的典型用法代码示例。如果您正苦于以下问题:Python go.is_eyeish方法的具体用法?Python go.is_eyeish怎么用?Python go.is_eyeish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类go
的用法示例。
在下文中一共展示了go.is_eyeish方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_is_eyeish
# 需要导入模块: import go [as 别名]
# 或者: from go import is_eyeish [as 别名]
def test_is_eyeish(self):
board = test_utils.load_board('''
.XX...XXX
X.X...X.X
XX.....X.
........X
XXXX.....
OOOX....O
X.OXX.OO.
.XO.X.O.O
XXO.X.OO.
''')
B_eyes = coords_from_kgs_set('A2 A9 B8 J7 H8')
W_eyes = coords_from_kgs_set('H2 J1 J3')
not_eyes = coords_from_kgs_set('B3 E5')
for be in B_eyes:
self.assertEqual(go.is_eyeish(board, be), BLACK, str(be))
for we in W_eyes:
self.assertEqual(go.is_eyeish(board, we), WHITE, str(we))
for ne in not_eyes:
self.assertEqual(go.is_eyeish(board, ne), None, str(ne))
示例2: test_is_eyeish
# 需要导入模块: import go [as 别名]
# 或者: from go import is_eyeish [as 别名]
def test_is_eyeish(self):
board = load_board('''
.XX...XXX
X.X...X.X
XX.....X.
........X
XXXX.....
OOOX....O
X.OXX.OO.
.XO.X.O.O
XXO.X.OO.
''')
B_eyes = pc_set('A2 A9 B8 J7 H8')
W_eyes = pc_set('H2 J1 J3')
not_eyes = pc_set('B3 E5')
for be in B_eyes:
self.assertEqual(go.is_eyeish(board, be), BLACK, str(be))
for we in W_eyes:
self.assertEqual(go.is_eyeish(board, we), WHITE, str(we))
for ne in not_eyes:
self.assertEqual(go.is_eyeish(board, ne), None, str(ne))
示例3: test_is_eyeish
# 需要导入模块: import go [as 别名]
# 或者: from go import is_eyeish [as 别名]
def test_is_eyeish(self):
board = utils_test.load_board('''
.XX...XXX
X.X...X.X
XX.....X.
........X
XXXX.....
OOOX....O
X.OXX.OO.
.XO.X.O.O
XXO.X.OO.
''')
B_eyes = coords_from_kgs_set('A2 A9 B8 J7 H8')
W_eyes = coords_from_kgs_set('H2 J1 J3')
not_eyes = coords_from_kgs_set('B3 E5')
for be in B_eyes:
self.assertEqual(go.is_eyeish(
utils_test.BOARD_SIZE, board, be), BLACK, str(be))
for we in W_eyes:
self.assertEqual(go.is_eyeish(
utils_test.BOARD_SIZE, board, we), WHITE, str(we))
for ne in not_eyes:
self.assertEqual(go.is_eyeish(
utils_test.BOARD_SIZE, board, ne), None, str(ne))
示例4: test_is_eyeish
# 需要导入模块: import go [as 别名]
# 或者: from go import is_eyeish [as 别名]
def test_is_eyeish(self):
board = test_utils.load_board('''
.XX...XXX
X.X...X.X
XX.....X.
........X
XXXX.....
OOOX....O
X.OXX.OO.
.XO.X.O.O
XXO.X.OO.
''')
B_eyes = coords_from_gtp_set('A2 A9 B8 J7 H8')
W_eyes = coords_from_gtp_set('H2 J1 J3')
not_eyes = coords_from_gtp_set('B3 E5')
for be in B_eyes:
self.assertEqual(go.is_eyeish(board, be), BLACK, str(be))
for we in W_eyes:
self.assertEqual(go.is_eyeish(board, we), WHITE, str(we))
for ne in not_eyes:
self.assertEqual(go.is_eyeish(board, ne), None, str(ne))
示例5: is_move_reasonable
# 需要导入模块: import go [as 别名]
# 或者: from go import is_eyeish [as 别名]
def is_move_reasonable(position, move):
# A move is reasonable if it is legal and doesn't fill in your own eyes.
return position.is_move_legal(move) and go.is_eyeish(position.board, move) != position.to_play
示例6: is_move_reasonable
# 需要导入模块: import go [as 别名]
# 或者: from go import is_eyeish [as 别名]
def is_move_reasonable(position, move):
return position.is_move_legal(move) and go.is_eyeish(position.board, move) != position.to_play
示例7: play_valid_move
# 需要导入模块: import go [as 别名]
# 或者: from go import is_eyeish [as 别名]
def play_valid_move(self, position, move_probs):
for move in sorted_moves(move_probs):
if go.is_eyeish(position.board, move):
continue
try:
candidate_pos = position.play_move(move, mutate=True)
except go.IllegalMove:
continue
else:
return candidate_pos
return position.pass_move(mutate=True)