Ejemplo n.º 1
0
        protected static void initUDSliceMoveConj()
        {
            CubieCube c = new CubieCube();
            CubieCube d = new CubieCube();

            for (int i = 0; i < N_SLICE; i++)
            {
                c.setUDSlice(i);
                for (int j = 0; j < N_MOVES; j += 3)
                {
                    CubieCube.EdgeMult(c, CubieCube.moveCube[j], d);
                    UDSliceMove[i, j] = (char)d.getUDSlice();
                }
                for (int j = 0; j < 16; j += 2)
                {
                    CubieCube.EdgeConjugate(c, CubieCube.SymInv[j], d);
                    UDSliceConj[i, j >> 1] = (char)(d.getUDSlice() & 0x1ff);
                }
            }
            for (int i = 0; i < N_SLICE; i++)
            {
                for (int j = 0; j < N_MOVES; j += 3)
                {
                    int udslice = UDSliceMove[i, j];
                    for (int k = 1; k < 3; k++)
                    {
                        int cx = UDSliceMove[udslice & 0x1ff, j];
                        udslice = Util.permMult[udslice >> 9, cx >> 9] << 9 | cx & 0x1ff;
                        UDSliceMove[i, j + k] = (char)udslice;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static String fromScramble(int[] scramble)
        {
            CubieCube c1 = new CubieCube();
            CubieCube c2 = new CubieCube();
            CubieCube tmp;

            for (int i = 0; i < scramble.Length; i++)
            {
                CubieCube.CornMult(c1, CubieCube.moveCube[scramble[i]], c2);
                CubieCube.EdgeMult(c1, CubieCube.moveCube[scramble[i]], c2);
                tmp = c1; c1 = c2; c2 = tmp;
            }
            return(Util.toFaceCube(c1));
        }
Ejemplo n.º 3
0
        protected static void initEPermMove()
        {
            CubieCube c = new CubieCube();
            CubieCube d = new CubieCube();

            for (int i = 0; i < N_PERM_SYM; i++)
            {
                c.setEPerm(CubieCube.EPermS2R[i]);
                for (int j = 0; j < N_MOVES2; j++)
                {
                    CubieCube.EdgeMult(c, CubieCube.moveCube[Util.ud2std[j]], d);
                    EPermMove[i, j] = (char)d.getEPermSym();
                }
            }
        }
Ejemplo n.º 4
0
        protected static void initFlipMove()
        {
            CubieCube c = new CubieCube();
            CubieCube d = new CubieCube();

            for (int i = 0; i < N_FLIP_SYM; i++)
            {
                c.setFlip(CubieCube.FlipS2R[i]);
                for (int j = 0; j < N_MOVES; j++)
                {
                    CubieCube.EdgeMult(c, CubieCube.moveCube[j], d);
                    FlipMove[i, j] = (char)d.getFlipSym();
                }
            }
        }
Ejemplo n.º 5
0
        private void initSearch()
        {
            conjMask = (TRY_INVERSE ? 0 : 0x38) | (TRY_THREE_AXES ? 0 : 0x36);
            CubieCube pc = new CubieCube();

            selfSym = cc.selfSymmetry();
            if (selfSym >> 48 != 0)
            {
                conjMask |= 0x38;
            }
            if ((selfSym >> 16 & 0xffff) != 0)
            {
                conjMask |= 0x12;
            }
            if ((selfSym >> 32 & 0xffff) != 0)
            {
                conjMask |= 0x24;
            }
            preIdxMax = conjMask > 7 ? 1 : PRE_IDX_MAX;
            for (int i = 0; i < 6; i++)
            {
                node0[i, 0].set(cc);
                corn0[i, 0] = cc.getCPermSym();
                ud8e0[i, 0] = cc.getU4Comb() << 16 | cc.getD4Comb();
                if ((conjMask & 1 << i) == 0)
                {
                    for (int j = 1; j < preIdxMax; j++)
                    {
                        CubieCube.CornMult(CubieCube.moveCube[CubieCube.preMove[j]], cc, pc);
                        CubieCube.EdgeMult(CubieCube.moveCube[CubieCube.preMove[j]], cc, pc);
                        node0[i, j].set(pc);
                        corn0[i, j] = pc.getCPermSym();
                        ud8e0[i, j] = pc.getU4Comb() << 16 | pc.getD4Comb();
                    }
                }
                cc.URFConjugate();
                if (i % 3 == 2)
                {
                    cc.invCubieCube();
                }
            }
            selfSym = selfSym & 0xffffffffffffL;
        }
Ejemplo n.º 6
0
        protected static void initMPermMoveConj()
        {
            CubieCube c = new CubieCube();
            CubieCube d = new CubieCube();

            for (int i = 0; i < N_MPERM; i++)
            {
                c.setMPerm(i);
                for (int j = 0; j < N_MOVES2; j++)
                {
                    CubieCube.EdgeMult(c, CubieCube.moveCube[Util.ud2std[j]], d);
                    MPermMove[i, j] = (char)d.getMPerm();
                }
                for (int j = 0; j < 16; j++)
                {
                    CubieCube.EdgeConjugate(c, CubieCube.SymInv[j], d);
                    MPermConj[i, j] = (char)d.getMPerm();
                }
            }
        }
Ejemplo n.º 7
0
        static void initUDSliceFlipMove()
        {
            CubieCube c = new CubieCube();
            CubieCube d = new CubieCube();

            for (int i = 0; i < N_UDSLICEFLIP_SYM; i++)
            {
                c.setUDSliceFlip(CubieCube.UDSliceFlipS2R[i]);
                int udslice = CubieCube.UDSliceFlipS2R[i] >> 11;
                for (int j = 0; j < N_MOVES; j++)
                {
                    CubieCube.EdgeMult(c, CubieCube.moveCube[j], d);
                    // UDSliceFlipMove[i, j] = d.getUDSliceFlipSym();

                    int flip = d.getFlipSym();
                    int fsym = flip & 0x7;
                    flip >>= 3;
                    int udsliceflip = CubieCube.FlipSlice2UDSliceFlip[flip * N_SLICE + UDSliceConj[UDSliceMove[udslice, j] & 0x1ff, fsym]];
                    UDSliceFlipMove[i, j] = udsliceflip & unchecked ((int)0xfffffff0) | CubieCube.SymMult[udsliceflip & 0xf, fsym << 1];
                }
            }
        }