@return 0: Found or Probe limit exceeded 1: Try Next Power 2: Try Next Axis
()
| 660 | * 2: Try Next Axis |
| 661 | */ |
| 662 | private int initPhase2() { |
| 663 | isRecovery = false; |
| 664 | if (probe >= (solution == null ? probeMax : probeMin)) { |
| 665 | return 0; |
| 666 | } |
| 667 | ++probe; |
| 668 | int cidx = corn0[urfIdx][preIdx] >> 4; |
| 669 | int csym = corn0[urfIdx][preIdx] & 0xf; |
| 670 | int mid = slice[urfIdx][preIdx]; |
| 671 | for (int i = 0; i < depth1; i++) { |
| 672 | int m = move[i]; |
| 673 | cidx = CoordCube.CPermMove[cidx][CubieCube.SymMove[csym][m]]; |
| 674 | csym = CubieCube.SymMult[cidx & 0xf][csym]; |
| 675 | cidx >>= 4; |
| 676 | |
| 677 | int cx = CoordCube.UDSliceMove[mid & 0x1ff][m]; |
| 678 | mid = Util.permMult[mid >> 9][cx >> 9] << 9 | cx & 0x1ff; |
| 679 | } |
| 680 | mid >>= 9; |
| 681 | int prun = CoordCube.getPruning(CoordCube.MCPermPrun, cidx * 24 + CoordCube.MPermConj[mid][csym]); |
| 682 | if (prun >= maxDep2) { |
| 683 | return prun > maxDep2 ? 2 : 1; |
| 684 | } |
| 685 | |
| 686 | int u4e = ud8e0[urfIdx][preIdx] >> 16; |
| 687 | int d4e = ud8e0[urfIdx][preIdx] & 0xffff; |
| 688 | for (int i = 0; i < depth1; i++) { |
| 689 | int m = move[i]; |
| 690 | |
| 691 | int cx = CoordCube.UDSliceMove[u4e & 0x1ff][m]; |
| 692 | u4e = Util.permMult[u4e >> 9][cx >> 9] << 9 | cx & 0x1ff; |
| 693 | |
| 694 | cx = CoordCube.UDSliceMove[d4e & 0x1ff][m]; |
| 695 | d4e = Util.permMult[d4e >> 9][cx >> 9] << 9 | cx & 0x1ff; |
| 696 | } |
| 697 | |
| 698 | int edge = CubieCube.MtoEPerm[494 - (u4e & 0x1ff) + (u4e >> 9) * 70 + (d4e >> 9) * 1680]; |
| 699 | int esym = edge & 0xf; |
| 700 | edge >>= 4; |
| 701 | |
| 702 | prun = Math.max(CoordCube.getPruning(CoordCube.MEPermPrun, edge * 24 + CoordCube.MPermConj[mid][esym]), prun); |
| 703 | if (prun >= maxDep2) { |
| 704 | return prun > maxDep2 ? 2 : 1; |
| 705 | } |
| 706 | |
| 707 | int lm = 10; |
| 708 | if (depth1 >= 2 && move[depth1 - 1] / 3 % 3 == move[depth1 - 2] / 3 % 3) { |
| 709 | lm = Util.std2ud[Math.max(move[depth1 - 1], move[depth1 - 2]) / 3 * 3 + 1]; |
| 710 | } else if (depth1 >= 1) { |
| 711 | lm = Util.std2ud[move[depth1 - 1] / 3 * 3 + 1]; |
| 712 | if (move[depth1 - 1] > Util.Fx3) { |
| 713 | lm = -lm; |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | int depth2; |
| 718 | for (depth2 = maxDep2 - 1; depth2 >= prun; depth2--) { |
| 719 | int ret = phase2(edge, esym, cidx, csym, mid, depth2, depth1, lm); |
no test coverage detected