Exemple #1
0
 public void Copy(CornerCube c)
 {
     for (int i = 0; i < 8; i++)
     {
         this.cp[i] = c.cp[i];
         this.co[i] = c.co[i];
     }
 }
Exemple #2
0
 public void Move(int idx)
 {
     if (temps == null)
     {
         temps = new CornerCube();
     }
     CornMult(this, moveCube[idx], temps);
     Copy(temps);
 }
Exemple #3
0
 /**
  * prod = a * b, Corner Only.
  */
 public static void CornMult(CornerCube a, CornerCube b, CornerCube prod)
 {
     for (int corn = 0; corn < 8; corn++)
     {
         prod.cp[corn] = a.cp[b.cp[corn]];
         sbyte oriA = a.co[b.cp[corn]];
         sbyte oriB = b.co[corn];
         sbyte ori  = oriA;
         ori += (sbyte)((oriA < 3) ? oriB : 6 - oriB);
         ori %= 3;
         if ((oriA >= 3) ^ (oriB >= 3))
         {
             ori += 3;
         }
         prod.co[corn] = ori;
     }
 }
Exemple #4
0
 static void InitMove()
 {
     moveCube[0]  = new CornerCube(15120, 0);
     moveCube[3]  = new CornerCube(21021, 1494);
     moveCube[6]  = new CornerCube(8064, 1236);
     moveCube[9]  = new CornerCube(9, 0);
     moveCube[12] = new CornerCube(1230, 412);
     moveCube[15] = new CornerCube(224, 137);
     for (int a = 0; a < 18; a += 3)
     {
         for (int p = 0; p < 2; p++)
         {
             moveCube[a + p + 1] = new CornerCube();
             CornMult(moveCube[a + p], moveCube[a], moveCube[a + p + 1]);
         }
     }
 }
Exemple #5
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;
                    }
                }
            }
        }
Exemple #6
0
 public CornerCube(CornerCube c)
 {
     Copy(c);
 }
Exemple #7
0
 public FullCube(Random r)
 {
     edge   = new EdgeCube(r);
     center = new CenterCube(r);
     corner = new CornerCube(r);
 }
Exemple #8
0
 public FullCube()
 {
     edge   = new EdgeCube();
     center = new CenterCube();
     corner = new CornerCube();
 }