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