本文整理汇总了Python中piece.Piece.place_on_board方法的典型用法代码示例。如果您正苦于以下问题:Python Piece.place_on_board方法的具体用法?Python Piece.place_on_board怎么用?Python Piece.place_on_board使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类piece.Piece
的用法示例。
在下文中一共展示了Piece.place_on_board方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rule_6
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import place_on_board [as 别名]
def rule_6(self, moves, game, pieces, data):
"""
try to create bridges across other players gaps if at all possible.
"""
metric = []
test_board = copy.deepcopy(game.board)
for move in moves:
t_board = test_board
t_piece = Piece(
move['pieceID'],
move['playerID'],
rotation=move['rotation'],
parity=move['parity'])
position = move['position']
before = find_bridge_instances(
t_board,
game.current_playerID,
position=move['position'],
size=t_piece.geometry.shape)
t_board = t_piece.place_on_board(t_board, position)
after = find_bridge_instances(
t_board,
game.current_playerID,
position=move['position'],
size=t_piece.geometry.shape)
# using before and after, encourages starting and crossing bridges
metric += [before + after]
return np.array(metric)
示例2: rule_5
# 需要导入模块: from piece import Piece [as 别名]
# 或者: from piece.Piece import place_on_board [as 别名]
def rule_5(self, moves, game, pieces, data):
"""
try to share edge space with opponents as much as possible
"""
metric = []
test_board = copy.deepcopy(game.board)
for move in moves:
t_board = test_board
t_piece = Piece(
move['pieceID'],
move['playerID'],
rotation=move['rotation'],
parity=move['parity'])
position = move['position']
t_board = t_piece.place_on_board(t_board, position)
after = find_edge_sharing(
t_board,
game.current_playerID,
position=move['position'],
size=t_piece.geometry.shape)
# using before and after, encourages starting and crossing bridges
metric += [after]
return np.array(metric)