Esempio n. 1
0
        internal static void InitFlipSym2Raw()
        {
            CubieCube c = new CubieCube();
            CubieCube d = new CubieCube();

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

            for (int i = 0; i < 2048 >> 5; occ[i++] = 0)
            {
                ;
            }
            FlipR2S = new char[2048];
            for (int i = 0; i < 2048; i++)
            {
                if ((occ[i >> 5] & (1 << (i & 0x1f))) == 0)
                {
                    c.SetFlip(i);
                    for (int s = 0; s < 16; s += 2)
                    {
                        EdgeConjugate(c, s, d);
                        int idx = d.GetFlip();
                        if (idx == i)
                        {
                            SymStateFlip[count] |= (char)(1 << (s >> 1));
                        }
                        occ[idx >> 5] |= 1 << (idx & 0x1f);
                        FlipR2S[idx]   = (char)((count << 3) | (s >> 1));
                    }
                    FlipS2R[count++] = (char)i;
                }
            }
        }
Esempio n. 2
0
 internal int GetFlipSym()
 {
     if (FlipR2S != null)
     {
         return(FlipR2S[GetFlip()]);
     }
     if (temps == null)
     {
         temps = new CubieCube();
     }
     for (int k = 0; k < 16; k += 2)
     {
         EdgeConjugate(this, SymInv[k], temps);
         int idx = Util.BinarySearch(FlipS2R, temps.GetFlip());
         if (idx != 0xffff)
         {
             return((idx << 3) | (k >> 1));
         }
     }
     return(0);
 }