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 void Copy(CenterCube c)
 {
     for (int i = 0; i < 24; i++)
     {
         this.ct[i] = c.ct[i];
     }
 }
Esempio n. 3
0
 public Center1(CenterCube c, int urf)
 {
     for (int i = 0; i < 24; i++)
     {
         ct[i] = (sbyte)((c.ct[i] % 3 == urf) ? 1 : 0);
     }
 }
Esempio n. 4
0
 public void Set(CenterCube c, int edgeParity)
 {
     for (int i = 0; i < 16; i++)
     {
         ct[i] = c.ct[i] % 3;
     }
     for (int i = 0; i < 8; i++)
     {
         rl[i] = c.ct[i + 16];
     }
     parity = edgeParity;
 }
Esempio n. 5
0
        public void Set(CenterCube c, int eXc_parity)
        {
            int parity = (c.ct[0] % 3 > c.ct[8] % 3 ^ c.ct[8] % 3 > c.ct[16] % 3 ^ c.ct[0] % 3 > c.ct[16] % 3) ? 0 : 1;

            for (int i = 0; i < 8; i++)
            {
                ud[i] = (c.ct[i] / 3) ^ 1;
                fb[i] = (c.ct[i + 8] / 3) ^ 1;
                rl[i] = (c.ct[i + 16] / 3) ^ 1 ^ parity;
            }
            this.parity = parity ^ eXc_parity;
        }
Esempio n. 6
0
        public FullCube(sbyte[] f)
        {
            edge   = new EdgeCube();
            center = new CenterCube();
            corner = new CornerCube();
            for (int i = 0; i < 24; i++)
            {
                center.ct[i] = f[centerFacelet[i]];
            }
            for (int i = 0; i < 24; i++)
            {
                for (sbyte j = 0; j < 24; j++)
                {
                    if (f[edgeFacelet[i, 0]] == edgeFacelet[j, 0] / 16 && f[edgeFacelet[i, 1]] == edgeFacelet[j, 1] / 16)
                    {
                        edge.ep[i] = j;
                    }
                }
            }
            sbyte col1, col2, ori;

            for (sbyte i = 0; i < 8; i++)
            {
                // get the colors of the cubie at corner i, starting with U/D
                for (ori = 0; ori < 3; ori++)
                {
                    if (f[cornerFacelet[i, ori]] == u0 / 16 || f[cornerFacelet[i, ori]] == d0 / 16)
                    {
                        break;
                    }
                }
                col1 = f[cornerFacelet[i, (ori + 1) % 3]];
                col2 = f[cornerFacelet[i, (ori + 2) % 3]];

                for (sbyte j = 0; j < 8; j++)
                {
                    if (col1 == cornerFacelet[j, 1] / 16 && col2 == cornerFacelet[j, 2] / 16)
                    {
                        // in cornerposition i we have cornercubie j
                        corner.cp[i] = j;
                        corner.co[i] = (sbyte)(ori % 3);
                        break;
                    }
                }
            }
        }
Esempio n. 7
0
 public CenterCube(CenterCube c)
 {
     Copy(c);
 }
Esempio n. 8
0
 public FullCube(Random r)
 {
     edge   = new EdgeCube(r);
     center = new CenterCube(r);
     corner = new CornerCube(r);
 }
Esempio n. 9
0
 public FullCube()
 {
     edge   = new EdgeCube();
     center = new CenterCube();
     corner = new CornerCube();
 }