(String facelets, boolean rotate, Random r)
| 94 | public static char[] rotateIdx = {0, 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'D', 'D', 'D'}; |
| 95 | |
| 96 | public synchronized String solution(String facelets, boolean rotate, Random r) { |
| 97 | String sol = solution(facelets, 21, 10000, 0, 2); |
| 98 | if (!rotate) return sol; |
| 99 | String[] moves = sol.split(" "); |
| 100 | char lastMove = moves[moves.length - 1].charAt(0); |
| 101 | int rot; |
| 102 | do { |
| 103 | rot = r.nextInt(24); |
| 104 | } while (rotateIdx[rot] == lastMove); |
| 105 | return sol + rotateStr[rot]; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Computes the solver string for a given cube. |
no test coverage detected