Example #1
0
 /*
  * This method scrambles a virtual cube, as such
  * it cannot be used with a real cube.
  */
 public static void Randomizer(Cube a, int count)
 {
     Random rand = new Random();
     int aux;
     for (int i = 0; i < count; i++) {
         aux = rand.Next () % 5;
         switch (aux) {
         case 0:
             a.TurnRowCW ();
             break;
         case 1:
             a.TurnRowCCW ();
             break;
         case 2:
             a.Roll ();
             break;
         case 3:
             a.TurnCubeCW ();
             break;
         case 4:
             a.TurnCubeCCW ();
             break;
         }
     }
     GoToInitial (a);
 }
Example #2
0
        /*
         * This method scrambles a virtual cube, as such
         * it cannot be used with a real cube.
         */
        public static void Randomizer(Cube a, int count)
        {
            Random rand = new Random();
            int    aux;

            for (int i = 0; i < count; i++)
            {
                aux = rand.Next() % 5;
                switch (aux)
                {
                case 0:
                    a.TurnRowCW();
                    break;

                case 1:
                    a.TurnRowCCW();
                    break;

                case 2:
                    a.Roll();
                    break;

                case 3:
                    a.TurnCubeCW();
                    break;

                case 4:
                    a.TurnCubeCCW();
                    break;
                }
            }
            GoToInitial(a);
        }
Example #3
0
 /*
  * This method positions any specified face in the bottom
  * of the cube (a face is specified by its central facelet).
  */
 public static void GoToFace(string face, Cube a)
 {
     if (a.face [5].square [1, 1].ToString() == face)
     {
         a.Roll();
         a.Roll();
     }
     else if (a.face [4].square [1, 1].ToString() == face)
     {
         a.Roll();
     }
     else if (a.face [3].square [1, 1].ToString() == face)
     {
         a.TurnCubeCW();
         a.Roll();
     }
     else if (a.face [2].square [1, 1].ToString() == face)
     {
         a.TurnCube180();
         a.Roll();
     }
     else if (a.face [1].square [1, 1].ToString() == face)
     {
         a.TurnCubeCCW();
         a.Roll();
     }
 }
Example #4
0
 /*
  * This method positions any specified face in the bottom
  * of the cube (a face is specified by its central facelet).
  */
 public static void GoToFace(string face, Cube a)
 {
     if (a.face [5].square [1, 1].ToString() == face) {
         a.Roll ();
         a.Roll ();
     } else if (a.face [4].square [1, 1].ToString () == face) {
         a.Roll ();
     } else if (a.face [3].square [1, 1].ToString () == face) {
         a.TurnCubeCW ();
         a.Roll ();
     } else if (a.face [2].square [1, 1].ToString () == face) {
         a.TurnCube180 ();
         a.Roll ();
     } else if (a.face [1].square [1, 1].ToString () == face) {
         a.TurnCubeCCW ();
         a.Roll ();
     }
 }