Пример #1
0
 static void initPermSym2Raw() {
   CubieCube c = new CubieCube();
   CubieCube d = new CubieCube();
   int[] occ = new int[40320 / 32];
   int count = 0;
   for (int i = 0; i < 40320 / 32; occ[i++] = 0) ;
   EPermR2S = new char[40320];
   for (int i = 0; i < 40320; i++) {
     if ((occ[i >> 5] & (1 << (i & 0x1f))) == 0) {
       c.setEPerm(i);
       for (int s = 0; s < 16; s++) {
         EdgeConjugate(c, s, d);
         int idx = d.getEPerm();
         if (idx == i) {
           SymStatePerm[count] |= 1 << s;
         }
         occ[idx >> 5] |= 1 << (idx & 0x1f);
         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);
       }
       EPermS2R[count++] = (char) i;
     }
   }
 }
Пример #2
0
 int getEPermSym() {
   if (EPermR2S != null) {
     return EPermR2S[getEPerm()];
   }
   if (temps == null) {
     temps = new CubieCube();
   }
   for (int k = 0; k < 16; k++) {
     EdgeConjugate(this, SymInv[k], temps);
     int idx = Util.binarySearch(EPermS2R, temps.getEPerm());
     if (idx != 0xffff) {
       return (idx << 4) | k;
     }
   }
   return 0;
 }
Пример #3
0
 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;
 }
Пример #4
0
 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] |= 1 << (s >> 1);
         }
         occ[idx >> 5] |= 1 << (idx & 0x1f);
         FlipR2S[idx] = (char) ((count << 3) | (s >> 1));
       }
       FlipS2R[count++] = (char) i;
     }
   }
 }