MCPcopy Create free account
hub / github.com/MeigenChou/DCTimer-Android / phase1

Method phase1

app/src/main/java/cs/min2phase/Search.java:367–452  ·  view source on GitHub ↗

@return 0: Found or Probe limit exceeded 1: Try Next Power 2: Try Next Axis

(int twist, int tsym, int flip, int fsym, int slice, int prun, int maxl, int lm)

Source from the content-addressed store, hash-verified

365 * 2: Try Next Axis
366 */
367 private int phase1(int twist, int tsym, int flip, int fsym, int slice, int prun, int maxl, int lm) {
368 if (twist == 0 && flip == 0 && slice == 0 && maxl < 5) {
369 if (maxl == 0) {
370 int ret = initPhase2();
371 if (ret == 0 || preIdx == 0) {
372 return ret;
373 }
374 preIdx++;
375 ret = Math.min(initPhase2(), ret);
376 preIdx--;
377 return ret;
378 } else {
379 return 1;
380 }
381 }
382
383 for (int axis = 0; axis < 18; axis += 3) {
384 if (axis == lm || axis == lm - 9 || (isRecovery && axis < move[depth1 - maxl] - 2)) {
385 continue;
386 }
387 for (int power = 0; power < 3; power++) {
388 int m = axis + power;
389
390 if (isRecovery && m != move[depth1 - maxl]) {
391 continue;
392 }
393
394 int slicex = CoordCube.UDSliceMove[slice][m] & 0x1ff;
395
396 int twistx = CoordCube.TwistMove[twist][CubieCube.Sym8Move[tsym][m]];
397 int tsymx = CubieCube.Sym8Mult[twistx & 7][tsym];
398 twistx >>= 3;
399
400 int flipx = CoordCube.FlipMove[flip][CubieCube.Sym8Move[fsym][m]];
401 int fsymx = CubieCube.Sym8Mult[flipx & 7][fsym];
402 flipx >>= 3;
403
404 int prunx;
405
406 if (USE_FULL_PRUN) {
407 prunx = CoordCube.getUDSliceFlipTwistPrun(twistx, tsymx, flipx, fsymx, slicex, prun);
408 // prun = CoordCube.getUDSliceFlipTwistPrun(twistx, tsymx, flipx, fsymx, slicex);
409 if (prunx > maxl) {
410 break;
411 } else if (prunx == maxl) {
412 continue;
413 }
414 } else {
415 if (USE_TWIST_FLIP_PRUN) {
416 prunx = CoordCube.getPruning(CoordCube.TwistFlipPrun,
417 twistx << 11 | CubieCube.FlipS2RF[flipx << 3 | CubieCube.Sym8MultInv[fsymx][tsymx]]);
418 if (prunx > maxl) {
419 break;
420 } else if (prunx == maxl) {
421 continue;
422 }
423 }
424

Callers 1

searchMethod · 0.95

Calls 3

initPhase2Method · 0.95
getPruningMethod · 0.95

Tested by

no test coverage detected