(int[] cp, int[] co, int[] ep, int[] eo)
| 199 | public static final int[] STATE_SOLVED = new int[0]; |
| 200 | |
| 201 | public static String randomState(int[] cp, int[] co, int[] ep, int[] eo) { |
| 202 | int parity; |
| 203 | int cntUE = ep == STATE_RANDOM ? 12 : countUnknown(ep); |
| 204 | int cntUC = cp == STATE_RANDOM ? 8 : countUnknown(cp); |
| 205 | int cpVal, epVal; |
| 206 | if (cntUE < 2) { //ep != STATE_RANDOM |
| 207 | if (ep == STATE_SOLVED) { |
| 208 | epVal = parity = 0; |
| 209 | } else { |
| 210 | parity = resolvePerm(ep, cntUE, -1); |
| 211 | epVal = Util.getNPerm(ep, 12); |
| 212 | } |
| 213 | if (cp == STATE_SOLVED) { |
| 214 | cpVal = 0; |
| 215 | } else if (cp == STATE_RANDOM) { |
| 216 | do { |
| 217 | cpVal = gen.nextInt(40320); |
| 218 | } while (Util.getNParity(cpVal, 8) != parity); |
| 219 | } else { |
| 220 | resolvePerm(cp, cntUC, parity); |
| 221 | cpVal = Util.getNPerm(cp, 8); |
| 222 | } |
| 223 | } else { //ep != STATE_SOLVED |
| 224 | if (cp == STATE_SOLVED) { |
| 225 | cpVal = parity = 0; |
| 226 | } else if (cp == STATE_RANDOM) { |
| 227 | cpVal = gen.nextInt(40320); |
| 228 | parity = Util.getNParity(cpVal, 8); |
| 229 | } else { |
| 230 | parity = resolvePerm(cp, cntUC, -1); |
| 231 | cpVal = Util.getNPerm(cp, 8); |
| 232 | } |
| 233 | if (ep == STATE_RANDOM) { |
| 234 | do { |
| 235 | epVal = gen.nextInt(479001600); |
| 236 | } while (Util.getNParity(epVal, 12) != parity); |
| 237 | } else { |
| 238 | resolvePerm(ep, cntUE, parity); |
| 239 | epVal = Util.getNPerm(ep, 12); |
| 240 | } |
| 241 | } |
| 242 | return Util.toFaceCube( |
| 243 | new CubieCube( |
| 244 | cpVal, |
| 245 | co == STATE_RANDOM ? gen.nextInt(2187) : (co == STATE_SOLVED ? 0 : resolveOri(co, 3)), |
| 246 | epVal, |
| 247 | eo == STATE_RANDOM ? gen.nextInt(2048) : (eo == STATE_SOLVED ? 0 : resolveOri(eo, 2)))); |
| 248 | } |
| 249 | |
| 250 | |
| 251 | public static String randomLastLayer() { |
no test coverage detected