本文整理汇总了Python中Engine.isOnRightEdge方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.isOnRightEdge方法的具体用法?Python Engine.isOnRightEdge怎么用?Python Engine.isOnRightEdge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine
的用法示例。
在下文中一共展示了Engine.isOnRightEdge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: validMoves
# 需要导入模块: import Engine [as 别名]
# 或者: from Engine import isOnRightEdge [as 别名]
def validMoves(self, position):
"""returns positions of valid moves for a regular red gamepiece on an empty board"""
moves = []
if Engine.isOnTopRow(position):
moves = []
elif Engine.isOnRightEdge(position) or Engine.isOnLeftEdge(position):
# Edges only have one valid move
moves = [position - 4]
elif Engine.isOnOddRow(position):
# diagonals above pieces on odd rows are always 4 and 5 pieces after
moves = [position - 4, position - 3]
elif Engine.isOnEvenRow(position):
# diagonals below pieces on even rows are always 3 and 4 piececs after
moves = [position - 5, position - 4]
return moves