internal 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); }
internal 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] |= (char)(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; } } }