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