(boolean lu)
| 79 | } |
| 80 | |
| 81 | public static String scramble(boolean lu) { |
| 82 | int cp, co, ep; |
| 83 | int[] c = new int[6], e = new int[7]; |
| 84 | Random r = new Random(); |
| 85 | do { |
| 86 | do { |
| 87 | cp = r.nextInt(720); |
| 88 | co = r.nextInt(243); |
| 89 | } |
| 90 | while (cd[cp * 243 + co] < 0); |
| 91 | ep = r.nextInt(5040); |
| 92 | Utils.idxToPerm(c, cp, 6, false); |
| 93 | Utils.idxToPerm(e, ep, 7, false); |
| 94 | } while (permutationSign(c) != permutationSign(e)); |
| 95 | for (int d = 0; d < 21; d++) { |
| 96 | if (search(cp, co, ep, d, -1)) { |
| 97 | if (d < 2) return scramble(lu); |
| 98 | if (d < 4) { |
| 99 | continue; |
| 100 | } |
| 101 | StringBuilder sb = new StringBuilder(); |
| 102 | for (int i = 1; i <= d; i++) { |
| 103 | if (lu) sb.append(turnlu[seq[i] / 3]).append(suff[seq[i] % 3]).append(" "); |
| 104 | else sb.append(turn[seq[i] / 3]).append(suffInv[seq[i] % 3]).append(" "); |
| 105 | } |
| 106 | return sb.toString(); |
| 107 | } |
| 108 | } |
| 109 | return "error"; |
| 110 | } |
| 111 | } |
no test coverage detected