private boolean isValidDiagonalMove(int r1, int c1, int r2, int c2) {
        if (Math.abs(r1 - r2) != Math.abs(c1 - c2)) {
            return false;
        }

        int stepR = r1 - r2 < 0 ? 1 : -1;
        int stepC = c1 - c2 < 0 ? 1 : -1;
        if (stepC > 0) {
            for (int r = r1 + stepR, c = c1 + stepC; c < c2; c += stepC, r += stepR) {
                if (board[r][c] != EMPTY) {
                    return false;
                }
            }
        } else if (stepC < 0) {
            for (int r = r1 + stepR, c = c1 + stepC; c > c2; c += stepC, r += stepR) {
                if (board[r][c] != EMPTY) {
                    return false;
                }
            }
        }

        return true;
    }