Esempio n. 1
0
        public static void CreateMoveTable()
        {
            //System.out.println("Create Phase1 Center Move Table...");
            Center1 c = new Center1();
            Center1 d = new Center1();

            for (int i = 0; i < 15582; i++)
            {
                d.Set(sym2raw[i]);
                for (int m = 0; m < 36; m++)
                {
                    c.Set(d);
                    c.Move(m);
                    ckmv[i, m] = c.Getsym();
                }
            }
        }
Esempio n. 2
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[i >> 5] & (1 << (i & 0x1f))) == 0) //>
                {
                    c.Set(i);
                    for (int j = 0; j < 48; j++)
                    {
                        int idx = c.Get();
                        occ[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;
                }
            }
            //assert count == 15582;
        }
Esempio n. 3
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);
                }
            }
        }