コード例 #1
0
        internal static void initFlipSym2Raw()
        {
            CubieCube c     = new CubieCube();
            CubieCube d     = new CubieCube();
            int       count = 0;

            FlipR2S = new char[2048];
            for (int i = 0; i < 2048; i++)
            {
                if (FlipR2S[i] != 0)
                {
                    continue;
                }
                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));
                    }
                    FlipR2S[idx] = (char)(count << 3 | s >> 1);
                    if (Search.USE_TWIST_FLIP_PRUN)
                    {
                        FlipS2RF[count << 3 | s >> 1] = (char)idx;
                    }
                }
                FlipS2R[count++] = (char)i;
            }
            if (count != 336)
            {
                throw new Exception("Unexpected count value");
            }
        }
コード例 #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 = Array.BinarySearch(FlipS2R, (char)temps.getFlip());
         if (idx >= 0)
         {
             return(idx << 3 | k >> 1);
         }
     }
     throw new Exception("assert getFlipSym()");
 }