| 144 | break |
| 145 | |
| 146 | def getKnightMoves(self, r,c,moves): |
| 147 | knightMoves = ((-2, -1), (-2, 1), (-1, -2), (-1, 2), (1, -2), (1, 2), (2, -1), (2,1)) |
| 148 | allyColor = "w" if self.whiteToMove else "b" |
| 149 | for m in knightMoves: |
| 150 | endRow = r + m[0] |
| 151 | endCol = c + m[1] |
| 152 | if 0 <= endRow < 8 and 0 <= endCol < 8: |
| 153 | endPiece = self.board[endRow][endCol] |
| 154 | if endPiece[0] != allyColor: |
| 155 | moves.append(Move((r,c), (endRow, endCol), self.board)) |
| 156 | |
| 157 | def getBishopMoves(self, r,c,moves): |
| 158 | directions = ((-1, -1), (-1, 1), (1, -1), (1, 1)) |