public static void setcube(Cube c, long index, int symtype) { int tg = (int)(index % 10368); int t = symGroupMembers[tg][symtype]; index = index / 10368; int os = (int)(index % 40320); index = index / 40320; int ms = (int)(index * 2) + (t + os) % 2; // match the permutation parity int m = symMiddleEdgePermutationIndex[ms][symtype]; int o = symOuterEdgePermutationIndex[os][symtype]; c.SetCornerPermutationFromIndex(t); c.SetOuterEdgePermutationFromIndex(o); c.SetMiddleEdgePermutationFromIndex(m); }
private static void BuildSymmetricalIndizes() { Cube c = new Cube(); symOuterEdgePermutationIndex = new int[40320][]; for (int i = 0; i < symOuterEdgePermutationIndex.Length; i++) { c.SetOuterEdgePermutationFromIndex(i); int s0 = c.GetOuterEdgePermutationIndex(); c.MirrorUD(); int ud = c.GetOuterEdgePermutationIndex(); c.MirrorLR(); int ud_lr = c.GetOuterEdgePermutationIndex(); c.MirrorUD(); int lr = c.GetOuterEdgePermutationIndex(); c.MirrorLR(); if (i != s0 || i != c.GetOuterEdgePermutationIndex()) { Console.WriteLine("outer edge permutation mirror calcuation error"); } symOuterEdgePermutationIndex[i] = new int[] { s0, ud, lr, ud_lr }; } symMiddleEdgePermutationIndex = new int[24][]; for (int i = 0; i < symMiddleEdgePermutationIndex.Length; i++) { c.SetMiddleEdgePermutationFromIndex(i); int s0 = c.GetMiddleEdgePermutationIndex(); c.MirrorUD(); int ud = c.GetMiddleEdgePermutationIndex(); c.MirrorLR(); int ud_lr = c.GetMiddleEdgePermutationIndex(); c.MirrorUD(); int lr = c.GetMiddleEdgePermutationIndex(); c.MirrorLR(); if (i != s0 || i != c.GetMiddleEdgePermutationIndex()) { Console.WriteLine("Middle Edge Permutation mirror calcuation error: " + i + "!=" + s0); } symMiddleEdgePermutationIndex[i] = new int[] { s0, ud, lr, ud_lr }; } }