(Random r)
| 98 | } |
| 99 | |
| 100 | public static String scramble(Random r) { |
| 101 | int ep, ct, cp; |
| 102 | int[] p = new int[6]; |
| 103 | do { |
| 104 | ep = r.nextInt(720); |
| 105 | ct = r.nextInt(4); |
| 106 | cp = r.nextInt(4); |
| 107 | Utils.idxToPerm(p, ep, 6, false); |
| 108 | } while (Utils.permutationSign(p) != ctcpSign(ct, cp)); |
| 109 | int eo = r.nextInt(32); |
| 110 | for (int d = 0; d < 21; d++) { |
| 111 | if (search(ep, eo, ct, cp, d, -1)) { |
| 112 | if (d < 2) return scramble(r); |
| 113 | if (d < 4) { |
| 114 | continue; |
| 115 | } |
| 116 | StringBuilder sb = new StringBuilder(); |
| 117 | for (int i = 1; i <= d; i++) |
| 118 | sb.append(turn[seq[i] / 3]).append(suffInv[seq[i] % 3]).append(" "); |
| 119 | return sb.toString(); |
| 120 | } |
| 121 | } |
| 122 | return "error"; |
| 123 | } |
| 124 | } |
no test coverage detected