(String[] s, int block, int d)
| 187 | } |
| 188 | |
| 189 | static String petrus2(String[] s, int block, int d) { |
| 190 | int[] co2 = new int[3], ep2 = new int[3], eo2 = new int[3]; |
| 191 | for (int i = 0; i < 3; i++) { |
| 192 | co2[i] = solvedCo[i]; |
| 193 | ep2[i] = solvedEp[i]; |
| 194 | eo2[i] = solvedEo[i]; |
| 195 | } |
| 196 | for (int i = 0; i < s.length; i++) { |
| 197 | if (s[i].length() > 0) { |
| 198 | int o = moveIdx[block].indexOf(s[i].charAt(0)); |
| 199 | for (int j = 0; j < 3; j++) { |
| 200 | co2[j] = com[co2[j]][o]; |
| 201 | ep2[j] = epm2[ep2[j]][o]; |
| 202 | eo2[j] = eom2[eo2[j]][o]; |
| 203 | if (s[i].length() > 1) { |
| 204 | co2[j] = com[co2[j]][o]; |
| 205 | ep2[j] = epm2[ep2[j]][o]; |
| 206 | eo2[j] = eom2[eo2[j]][o]; |
| 207 | if (s[i].charAt(1) == '\'') { |
| 208 | co2[j] = com[co2[j]][o]; |
| 209 | ep2[j] = epm2[ep2[j]][o]; |
| 210 | eo2[j] = eom2[eo2[j]][o]; |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | for (int i = d; i > 0; i--) { |
| 217 | int m = seq[i] / 3, n = seq[i] % 3; |
| 218 | for (int j = 0; j < 3; j++) { |
| 219 | for (int k = 0; k <= n; k++) { |
| 220 | co2[j] = com[co2[j]][m]; |
| 221 | ep2[j] = epm2[ep2[j]][m]; |
| 222 | eo2[j] = eom2[eo2[j]][m]; |
| 223 | } |
| 224 | } |
| 225 | } |
| 226 | for (int l = 0; l < 10; l++) { |
| 227 | for (int idx = 0; idx < 3; idx++) |
| 228 | if (idaPetrus2(co2[idx], ep2[idx], eo2[idx], l, -1, idx)) { |
| 229 | StringBuilder sb = new StringBuilder(" /"); |
| 230 | for (int i = l; i > 0; i--) |
| 231 | sb.append(' ').append(moveIdx[block].charAt(seq[i] / 3)).append(suff[seq[i] % 3]); |
| 232 | return sb.toString(); |
| 233 | } |
| 234 | } |
| 235 | return " / error"; |
| 236 | } |
| 237 | |
| 238 | public static String solvePetrus(String scramble, int block) { |
| 239 | initp1(); |
no test coverage detected