Пример #1
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];
                }
            }
        }
Пример #2
0
        internal static void initUDSliceFlipSym2Raw()
        {
            CubieCube c = new CubieCube();
            CubieCube d = new CubieCube();

            int[] occ   = new int[2048 * 495 >> 5];
            int   count = 0;

            for (int i = 0; i < 2048 * 495; i++)
            {
                if ((occ[i >> 5] & 1 << (i & 0x1f)) != 0)
                {
                    continue;
                }
                c.setUDSliceFlip(i);
                for (int s = 0; s < 16; s++)
                {
                    EdgeConjugate(c, s, d);
                    int idx = d.getUDSliceFlip();
                    if (idx == i)
                    {
                        SymStateUDSliceFlip[count] |= (char)(1 << s);
                    }
                    occ[idx >> 5] |= 1 << (idx & 0x1f);
                    int fidx = Array.BinarySearch(FlipS2R, (char)(idx & 0x7ff));
                    if (fidx >= 0)
                    {
                        FlipSlice2UDSliceFlip[fidx * CoordCube.N_SLICE + (idx >> 11)] = count << 4 | s;
                    }
                }
                UDSliceFlipS2R[count++] = i;
            }
            if (count != 64430)
            {
                throw new Exception("Unexpected count value");
            }
        }