示例#1
0
        public static void InitSym2Raw()
        {
            Center1 c = new Center1();

            int[] occ   = new int[735471 / 32 + 1];
            int   count = 0;

            for (int i = 0; i < 735471; i++)
            {
                if ((occ[(uint)i >> 5] & (1 << (i & 0x1f))) == 0)
                {
                    c.Set(i);
                    for (int j = 0; j < 48; j++)
                    {
                        int idx = c.Get();
                        occ[(uint)idx >> 5] |= (1 << (idx & 0x1f));
                        if (Raw2sym != null)
                        {
                            Raw2sym[idx] = count << 6 | Syminv[j];
                        }
                        c.Rot(0);
                        if (j % 2 == 1)
                        {
                            c.Rot(1);
                        }
                        if (j % 8 == 7)
                        {
                            c.Rot(2);
                        }
                        if (j % 16 == 15)
                        {
                            c.Rot(3);
                        }
                    }
                    sym2raw[count++] = i;
                }
            }
        }
示例#2
0
        public static void InitSym()
        {
            Center1 c = new Center1();

            for (sbyte i = 0; i < 24; i++)
            {
                c.Ct[i] = i;
            }
            Center1 d = new Center1(c.Ct);
            Center1 e = new Center1(c.Ct);
            Center1 f = new Center1(c.Ct);

            for (int i = 0; i < 48; i++)
            {
                for (int j = 0; j < 48; j++)
                {
                    for (int k = 0; k < 48; k++)
                    {
                        if (c.Equals(d))
                        {
                            Symmult[i][j] = k;
                            if (k == 0)
                            {
                                Syminv[i] = j;
                            }
                        }
                        d.Rot(0);
                        if (k % 2 == 1)
                        {
                            d.Rot(1);
                        }
                        if (k % 8 == 7)
                        {
                            d.Rot(2);
                        }
                        if (k % 16 == 15)
                        {
                            d.Rot(3);
                        }
                    }
                    c.Rot(0);
                    if (j % 2 == 1)
                    {
                        c.Rot(1);
                    }
                    if (j % 8 == 7)
                    {
                        c.Rot(2);
                    }
                    if (j % 16 == 15)
                    {
                        c.Rot(3);
                    }
                }
                c.Rot(0);
                if (i % 2 == 1)
                {
                    c.Rot(1);
                }
                if (i % 8 == 7)
                {
                    c.Rot(2);
                }
                if (i % 16 == 15)
                {
                    c.Rot(3);
                }
            }

            for (int i = 0; i < 48; i++)
            {
                c.Set(e);
                c.Rotate(Syminv[i]);
                for (int j = 0; j < 36; j++)
                {
                    d.Set(c);
                    d.Move(j);
                    d.Rotate(i);
                    for (int k = 0; k < 36; k++)
                    {
                        f.Set(e);
                        f.Move(k);
                        if (f.Equals(d))
                        {
                            Symmove[i][j] = k;
                            break;
                        }
                    }
                }
            }

            c.Set(0);
            for (int i = 0; i < 48; i++)
            {
                Finish[Syminv[i]] = c.Get();
                c.Rot(0);
                if (i % 2 == 1)
                {
                    c.Rot(1);
                }
                if (i % 8 == 7)
                {
                    c.Rot(2);
                }
                if (i % 16 == 15)
                {
                    c.Rot(3);
                }
            }
        }