static void initTwistMoveConj() { CubieCube c = new CubieCube(); CubieCube d = new CubieCube(); for (int i = 0; i < N_TWIST; i++) { c.setTwist(i); for (int j = 0; j < N_MOVES; j += 3) { CubieCube.CornMult(c, CubieCube.moveCube[j], d); TwistMoveF[i, j] = (char)d.getTwist(); } for (int j = 0; j < 16; j++) { CubieCube.CornConjugate(c, CubieCube.SymInv[j], d); TwistConj[i, j] = (char)d.getTwist(); } } for (int i = 0; i < N_TWIST; i++) { for (int j = 0; j < N_MOVES; j += 3) { int twist = TwistMoveF[i, j]; for (int k = 1; k < 3; k++) { twist = TwistMoveF[twist, j]; TwistMoveF[i, j + k] = (char)twist; } } } }
internal static void initTwistSym2Raw() { CubieCube c = new CubieCube(); CubieCube d = new CubieCube(); int count = 0; TwistR2S = new char[2187]; for (int i = 0; i < 2187; i++) { if (TwistR2S[i] != 0) { continue; } c.setTwist(i); for (int s = 0; s < 16; s += 2) { CornConjugate(c, s, d); int idx = d.getTwist(); if (idx == i) { SymStateTwist[count] |= (char)(1 << (s >> 1)); } TwistR2S[idx] = (char)(count << 3 | s >> 1); if (Search.EXTRA_PRUN_LEVEL > 0) { TwistS2RF[count << 3 | s >> 1] = (char)idx; } } TwistS2R[count++] = (char)i; } if (count != 324) { throw new Exception("Unexpected count value"); } }
internal override void set(CubieCube cc) { twist = cc.getTwist(); flip = cc.getUDSliceFlipSym(); slice = cc.getUDSlice(); fsym = flip & 0xf; flip >>= 4; if (Search.EXTRA_PRUN_LEVEL > 1) { tsym = cc.getCComb(); //tsym -> CComb } }
internal 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 = Array.BinarySearch(TwistS2R, (char)temps.getTwist()); if (idx >= 0) { return(idx << 3 | k >> 1); } } throw new Exception("assert getTwistSym()"); }