当前位置: 首页>>代码示例>>Python>>正文


Python Piece.place_on_board方法代码示例

本文整理汇总了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)
开发者ID:b-r-oleary,项目名称:games,代码行数:30,代码来源:player.py

示例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)
开发者ID:b-r-oleary,项目名称:games,代码行数:25,代码来源:player.py


注:本文中的piece.Piece.place_on_board方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。