コード例 #1
0
 def pieceValue(self, piece):
     if pieces.isPawn(piece):   return 1
     if pieces.isKnight(piece): return 3
     if pieces.isBishop(piece): return 3
     if pieces.isRook(piece):   return 5
     if pieces.isQueen(piece):  return 9
     if pieces.isKing(piece):   return 5
     else:                      return 0
コード例 #2
0
ファイル: rules.py プロジェクト: Lambdanaut/Chess
def possibleMoves(board,x,y):
    piece = getPiece(board,x,y)
    if   pieces.isPawn(piece):   return pawnMoves(board,piece,x,y)
    elif pieces.isRook(piece):   return rookMoves(board,piece,x,y)
    elif pieces.isKnight(piece): return knightMoves(board,piece,x,y)
    elif pieces.isBishop(piece): return bishopMoves(board,piece,x,y)
    elif pieces.isKing(piece):   return kingMoves(board,piece,x,y)
    elif pieces.isQueen(piece):  return queenMoves(board,piece,x,y)
    else:                        return []