本文整理汇总了Python中Engine.isOnTopRow方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.isOnTopRow方法的具体用法?Python Engine.isOnTopRow怎么用?Python Engine.isOnTopRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine
的用法示例。
在下文中一共展示了Engine.isOnTopRow方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: validMoves
# 需要导入模块: import Engine [as 别名]
# 或者: from Engine import isOnTopRow [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
示例2: canBePromoted
# 需要导入模块: import Engine [as 别名]
# 或者: from Engine import isOnTopRow [as 别名]
def canBePromoted(self, position): return Engine.isOnTopRow(position)
"""Red Pieces can be promoted when they're on the top row"""
示例3: test_isOnTopRow_returnsFalse_forNonTopsRows
# 需要导入模块: import Engine [as 别名]
# 或者: from Engine import isOnTopRow [as 别名]
def test_isOnTopRow_returnsFalse_forNonTopsRows(self, value):
self.assertFalse(Engine.isOnTopRow(value))
示例4: test_isOnTopRow_returnsTrue_forTopRow
# 需要导入模块: import Engine [as 别名]
# 或者: from Engine import isOnTopRow [as 别名]
def test_isOnTopRow_returnsTrue_forTopRow(self, value):
self.assertTrue(Engine.isOnTopRow(value))