Ejemplo n.º 1
0
 /**
  * initializing from cached tables(move table, pruning table, etc.)
  *
  * @param in
  *     Where to read tables.
  *
  * @see cs.min2phase.Tools#saveTo(java.io.DataOutput)
  */
 public static void initFrom(System.IO.BinaryReader input)
 {
     if (Search.inited)
     {
         return;
     }
     CubieCube.initMove();
     CubieCube.initSym();
     read(CubieCube.FlipS2R, input);
     read(CubieCube.TwistS2R, input);
     read(CubieCube.EPermS2R, input);
     read(CubieCube.MtoEPerm, input);
     read(CubieCube.Perm2Comb, input);
     read(CoordCube.TwistMove, input);
     read(CoordCube.FlipMove, input);
     read(CoordCube.UDSliceMove, input);
     read(CoordCube.UDSliceConj, input);
     read(CoordCube.CPermMove, input);
     read(CoordCube.EPermMove, input);
     read(CoordCube.MPermMove, input);
     read(CoordCube.MPermConj, input);
     read(CoordCube.CCombMove, input);
     read(CoordCube.CCombConj, input);
     read(CoordCube.MCPermPrun, input);
     read(CoordCube.MEPermPrun, input);
     read(CoordCube.EPermCCombPrun, input);
     if (Search.EXTRA_PRUN_LEVEL > 0)
     {
         read(CubieCube.UDSliceFlipS2R, input);
         read(CubieCube.TwistS2RF, input);
         read(CoordCubeHuge.TwistMoveF, input);
         read(CoordCubeHuge.TwistConj, input);
         read(CoordCubeHuge.UDSliceFlipMove, input);
         read(CubieCube.FlipSlice2UDSliceFlip, input);
         CoordCubeHuge.initUDSliceFlipTwistPrun();
     }
     else
     {
         read(CoordCube.UDSliceTwistPrun, input);
         read(CoordCube.UDSliceFlipPrun, input);
         if (Search.USE_TWIST_FLIP_PRUN)
         {
             read(CubieCube.FlipS2RF, input);
             read(CoordCube.TwistFlipPrun, input);
         }
     }
     Search.inited = true;
 }
Ejemplo n.º 2
0
        public static void init()
        {
            if (inited)
            {
                return;
            }
            CubieCube.initMove();
            CubieCube.initSym();

            if (EXTRA_PRUN_LEVEL > 0)
            {
                CoordCubeHuge.init();
            }
            else
            {
                CoordCube.init();
            }

            inited = true;
        }
Ejemplo n.º 3
0
        internal override void calcPruning(bool isPhase1)
        {
            int prunm3 = 0;

            if (Search.EXTRA_PRUN_LEVEL > 1 && !isPhase1)
            {
                prunm3 = getPruningP(HugePrunP, flip * ((long)N_TWIST) * N_COMB + TwistConj[twist, fsym] * N_COMB + CCombConj[tsym, fsym], N_HUGE_5 * 4L);
            }
            else
            {
                prunm3 = getPruningP(UDSliceFlipTwistPrunP, flip * N_TWIST + TwistConj[twist, fsym], N_UDSLICEFLIP_SYM * N_TWIST / 5 * 4);
            }
            prun = 0;
            CoordCubeHuge tmp1 = new CoordCubeHuge();
            CoordCubeHuge tmp2 = new CoordCubeHuge();

            tmp1.set(this);
            tmp1.prun = prunm3;
            while (tmp1.twist != 0 || tmp1.flip != 0 || tmp1.tsym != 0 && !isPhase1)
            {
                ++prun;
                if (tmp1.prun == 0)
                {
                    tmp1.prun = 3;
                }
                for (int m = 0; m < 18; m++)
                {
                    int gap = tmp2.doMovePrun(tmp1, m, isPhase1);
                    if (gap < tmp1.prun)
                    {
                        tmp1.set(tmp2);
                        break;
                    }
                }
            }
        }