def checkMove(board, col, row): possibleMoves = [] # Check up if its free and in the board range if (Board.validSquare(board, col, row - 1) and Board.comaprePieceat(board, col, row - 1, "E")): possibleMoves.append([col, row - 1]) # Check up for a jump over another piece elif (Board.validSquare(board, col, row - 2) and not (Board.comaprePieceat(board, col, row - 1, "E")) and Board.comaprePieceat(board, col, row - 2, "E")): possibleMoves.append([col, row - 2]) # Check down if its free and in the board range if (Board.validSquare(board, col, row + 1) and Board.comaprePieceat(board, col, row + 1, "E")): possibleMoves.append([col, row + 1]) # Check down for a jump over another piece elif (((Board.validSquare(board, col, row + 2)) and not (Board.comaprePieceat(board, col, row - 1, "E"))) and (Board.comaprePieceat(board, col, row + 2, "E"))): possibleMoves.append([col, row + 2]) # check left if its free and in the board range if (Board.validSquare(board, col - 1, row) and Board.comaprePieceat(board, col - 1, row, "E")): possibleMoves.append([col - 1, row]) # check left for a jump over another piece elif ((Board.validSquare(board, col - 2, row) and not (Board.comaprePieceat(board, col - 1, row, "E"))) and (Board.comaprePieceat(board, col - 2, row, "E"))): possibleMoves.append([col - 2, row]) # check right if its free and in the board range if (Board.validSquare(board, col + 1, row) and (Board.comaprePieceat(board, col + 1, row, "E"))): possibleMoves.append([col + 1, row]) # check right for a jump over another piece elif ((Board.validSquare(board, col + 2, row) and not (Board.comaprePieceat(board, col + 1, row, "E"))) and (Board.comaprePieceat(board, col + 2, row, "E"))): possibleMoves.append([col + 2, row]) #return the total number of moves available for that piece return possibleMoves
def checkDiagRightDown(board,col,row, colour): if (Board.validSquare(board,col+1,row+1) and (Board.comaprePieceat( board,col+1,row+1, colour))): return 1 return 0
def checkDiagLeftUp(board,col,row, colour): if (Board.validSquare(board,col-1,row-1) and (Board.comaprePieceat( board,col-1,row-1, colour))): return 1 return 0