Esempio n. 1
0
        public static int GetSolvedSym(CenterCube cube)
        {
            Center1 c = new Center1(cube.ct);

            for (int j = 0; j < 48; j++)
            {
                bool check = true;
                for (int i = 0; i < 24; i++)
                {
                    if (c.ct[i] != FullCube.centerFacelet[i] / 16)
                    {
                        check = false;
                        break;
                    }
                }
                if (check)
                {
                    return(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);
                }
            }
            return(-1);
        }
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);
                }
            }
        }