Ejemplo n.º 1
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.º 2
0
        internal static void initPermSym2Raw()
        {
            CubieCube c     = new CubieCube();
            CubieCube d     = new CubieCube();
            int       count = 0;

            EPermR2S = new char[40320];

            for (int i = 0; i < 40320; i++)
            {
                if (EPermR2S[i] != 0)
                {
                    continue;
                }
                c.setEPerm(i);
                for (int s = 0; s < 16; s++)
                {
                    EdgeConjugate(c, s, d);
                    int idx = d.getEPerm();
                    if (idx == i)
                    {
                        SymStatePerm[count] |= (char)(1 << s);
                    }
                    int a = d.getU4Comb();
                    int b = d.getD4Comb() >> 9;
                    int m = 494 - (a & 0x1ff) + (a >> 9) * 70 + b * 1680;
                    MtoEPerm[m] = EPermR2S[idx] = (char)(count << 4 | s);
                    if (s == 0)
                    {
                        Perm2Comb[count] = (byte)(494 - (a & 0x1ff));
                    }
                }
                EPermS2R[count++] = (char)i;
            }
            if (count != 2768)
            {
                throw new Exception("Unexpected count value");
            }
        }