Beispiel #1
0
 int getTwistSym() {
   if (TwistR2S != null) {
     return TwistR2S[getTwist()];
   }
   if (temps == null) {
     temps = new CubieCube();
   }
   for (int k = 0; k < 16; k += 2) {
     CornConjugate(this, SymInv[k], temps);
     int idx = Util.binarySearch(TwistS2R, temps.getTwist());
     if (idx != 0xffff) {
       return (idx << 3) | (k >> 1);
     }
   }
   return 0;
 }
Beispiel #2
0
 static void initTwistSym2Raw() {
   CubieCube c = new CubieCube();
   CubieCube d = new CubieCube();
   int[] occ = new int[2187 / 32 + 1];
   int count = 0;
   for (int i = 0; i < 2187 / 32 + 1; occ[i++] = 0) ;
   TwistR2S = new char[2187];
   for (int i = 0; i < 2187; i++) {
     if ((occ[i >> 5] & (1 << (i & 0x1f))) == 0) {
       c.setTwist(i);
       for (int s = 0; s < 16; s += 2) {
         CornConjugate(c, s, d);
         int idx = d.getTwist();
         if (idx == i) {
           SymStateTwist[count] |= 1 << (s >> 1);
         }
         occ[idx >> 5] |= 1 << (idx & 0x1f);
         TwistR2S[idx] = (char) ((count << 3) | (s >> 1));
       }
       TwistS2R[count++] = (char) i;
     }
   }
 }