本文整理汇总了Python中Board.allied方法的典型用法代码示例。如果您正苦于以下问题:Python Board.allied方法的具体用法?Python Board.allied怎么用?Python Board.allied使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Board
的用法示例。
在下文中一共展示了Board.allied方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: canMove
# 需要导入模块: import Board [as 别名]
# 或者: from Board import allied [as 别名]
def canMove(self, unit, destination):
if not Board.allied(destination.country, unit.country):
return False
if unit not in self.board.attackMoveList:
return super(self).canMove(unit, destination)
elif unit.isFlying():
previousMove = self.board.getPath(unit.previousTerritory, unit.territory, unit)
newMove = self.board.getPath(unit.territory, destination, unit)
return previousMove + newMove < self.board.unitInfo(unit.type).movement
示例2: nextPhase
# 需要导入模块: import Board [as 别名]
# 或者: from Board import allied [as 别名]
def nextPhase(self, board):
conflicts = {} # list of territories being attacked, and the attacking units
for (unit, start, dest) in self.moveList:
if not Board.allied(dest.country, unit.country):
if dest not in conflicts:
conflicts[dest] = [unit]
else:
conflicts[dest].append(unit)
else:
# not in conflict
unit.previousTerritory = unit.territory
unit.territory = dest
board.attackMoveList = self.moveList
board.currentPhase = ResolvePhase(conflicts, self.board)
return board.currentPhase