public boolean equals(Object y) {
        if (y == this) return true;
        if (y == null || !(y instanceof Board)) return false;
        Board that = (Board) y;
        for (int i = 0; i < N2; i++) {
            if (tiles[i] != that.tiles[i]) return false;
        }
        return true;
    }