| 328 | } |
| 329 | |
| 330 | public static String solveCrossf(String scramble) { |
| 331 | init(); |
| 332 | String[] s = scramble.split(" "); |
| 333 | StringBuilder sb = new StringBuilder(); |
| 334 | for (int face = 0; face < 6; face++) { |
| 335 | int ep = 1656, eo = 1104; |
| 336 | for (int i = 0; i < s.length; i++) |
| 337 | if (s[i].length() != 0) { |
| 338 | int m = moveStr[0][face].indexOf(s[i].charAt(0)); |
| 339 | eo = eom[eo][m]; ep = epm[ep][m]; |
| 340 | if (s[i].length() > 1) { |
| 341 | eo = eom[eo][m]; ep = epm[ep][m]; |
| 342 | if (s[i].charAt(1) == '\'') { |
| 343 | eo = eom[eo][m]; ep = epm[ep][m]; |
| 344 | } |
| 345 | } |
| 346 | } |
| 347 | solutions = new ArrayList<>(); |
| 348 | for (int d = 0; d < 9; d++) { |
| 349 | int[] path = new int[d + 1]; |
| 350 | idacross(ep, eo, d, -1, face, path); |
| 351 | if (solutions.size() > 0) { |
| 352 | sb.append(color[face]).append(":\n"); |
| 353 | for (String sol : solutions) { |
| 354 | int idx = sol.indexOf('\t'); |
| 355 | sb.append(" ").append(sol.substring(0, idx)).append("\n"); |
| 356 | } |
| 357 | sb.append("\n"); |
| 358 | break; |
| 359 | } |
| 360 | } |
| 361 | } |
| 362 | return sb.toString(); |
| 363 | } |
| 364 | |
| 365 | private static String xcross(String scramble, int face) { |
| 366 | String[] s = scramble.split(" "); |