示例#1
0
        private static void BuildCornerSymGroup()
        {
            cornerSymGroup  = new int[40320];
            symGroupMembers = new int[10368][];
            for (int i = 0; i < cornerSymGroup.Length; i++)
            {
                cornerSymGroup[i] = -1;
            }
            int numGroups = 0;

            Cube c = new Cube();

            for (int i = 0; i < cornerSymGroup.Length; i++)
            {
                if (cornerSymGroup[i] < 0)
                {
                    c.SetCornerPermutationFromIndex(i);
                    int s0 = c.GetCornerPermutationIndex();
                    c.MirrorUD();
                    int ud = c.GetCornerPermutationIndex();
                    c.MirrorLR();
                    int ud_lr = c.GetCornerPermutationIndex();
                    c.MirrorUD();
                    int lr = c.GetCornerPermutationIndex();
                    c.MirrorLR();
                    if (s0 != c.GetCornerPermutationIndex() || i != s0)
                    {
                        Console.WriteLine("ERROR: symmetry action do not match original situation!");
                    }

                    int g = numGroups++;

                    if (cornerSymGroup[s0] >= 0 || cornerSymGroup[ud] >= 0 || cornerSymGroup[lr] >= 0 || cornerSymGroup[ud_lr] >= 0
                        )
                    {
                        Console.WriteLine("ERROR: Overwriting symmetry group member");
                    }

                    cornerSymGroup[s0]    = g;
                    cornerSymGroup[ud]    = g;
                    cornerSymGroup[lr]    = g;
                    cornerSymGroup[ud_lr] = g;

                    symGroupMembers[g] = new int[] { s0, ud, lr, ud_lr };

//                        Console.Write(g + ": " + s0 + " " + ud + " " + lr + " " + ud_lr + "  ");
//                        Console.WriteLine();
                }
            }
        }
示例#2
0
        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);
        }
示例#3
0
        private static void BuildCornerSymGroup()
        {
            cornerSymGroup = new int[40320];
            symGroupMembers = new int[10368][];
            for (int i = 0; i < cornerSymGroup.Length; i++)
            {
                cornerSymGroup[i] = -1;
            }
            int numGroups = 0;

            Cube c = new Cube();

            for (int i = 0; i < cornerSymGroup.Length; i++)
            {
                if (cornerSymGroup[i] < 0)
                {
                    c.SetCornerPermutationFromIndex(i);
                    int s0 = c.GetCornerPermutationIndex();
                    c.MirrorUD();
                    int ud = c.GetCornerPermutationIndex();
                    c.MirrorLR();
                    int ud_lr = c.GetCornerPermutationIndex();
                    c.MirrorUD();
                    int lr = c.GetCornerPermutationIndex();
                    c.MirrorLR();
                    if (s0 != c.GetCornerPermutationIndex() || i != s0)
                    {
                        Console.WriteLine("ERROR: symmetry action do not match original situation!");
                    }

                    int g = numGroups++;

                    if (cornerSymGroup[s0] >= 0 || cornerSymGroup[ud] >= 0 ||  cornerSymGroup[lr] >= 0 || cornerSymGroup[ud_lr] >= 0
                    )
                    {
                        Console.WriteLine("ERROR: Overwriting symmetry group member");
                    }

                    cornerSymGroup[s0] = g;
                    cornerSymGroup[ud] = g;
                    cornerSymGroup[lr] = g;
                    cornerSymGroup[ud_lr] = g;

                    symGroupMembers[g] = new int[] { s0, ud, lr, ud_lr };

            //                        Console.Write(g + ": " + s0 + " " + ud + " " + lr + " " + ud_lr + "  ");
            //                        Console.WriteLine();
                }
            }
        }
示例#4
0
        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);
        }