public static float Search(List<Vector2> current, List<Vector2> target, float a, float b, float epsilon)
        {
            float x1 = ReductionFactor * a + (1 - ReductionFactor) * b;
            List<Vector2> rotatedList = current.Rotate(x1);
            float fx1 = rotatedList.DistanceTo(target);

            float x2 = (1 - ReductionFactor) * a + ReductionFactor * b;
            rotatedList = current.Rotate(x2);
            float fx2 = rotatedList.DistanceTo(target);

            do
            {
                if (fx1 < fx2)
                {
                    b = x2;
                    x2 = x1;
                    fx2 = fx1;
                    x1 = ReductionFactor * a + (1 - ReductionFactor) * b;
                    rotatedList = current.Rotate(x1);
                    fx1 = rotatedList.DistanceTo(target);
                }
                else
                {
                    a = x1;
                    x1 = x2;
                    fx1 = fx2;
                    x2 = (1 - ReductionFactor) * a + ReductionFactor * b;
                    rotatedList = current.Rotate(x2);
                    fx2 = rotatedList.DistanceTo(target);
                }
            }
            while (Math.Abs(b - a) > epsilon);

            float min = Math.Min(fx1, fx2);

            return 1.0f - 2.0f * min / Diagonal;
        }
 public Cube BuildCube()
 {
     var numberOfFaces = 6;
      var facelets = new List<Facelet>(3 * 3 * numberOfFaces);
      facelets.AddRange(BuildFacelets("Orange", Colors.Orange));
      facelets.Rotate(Directions.Right, 90);
      facelets.AddRange(BuildFacelets("Green", Colors.Green));
      facelets.Rotate(Directions.Right, 90);
      facelets.AddRange(BuildFacelets("Red", Colors.Red));
      facelets.Rotate(Directions.Right, 90);
      facelets.AddRange(BuildFacelets("Blue", Colors.Blue));
      facelets.Rotate(Directions.Up, 90);
      facelets.AddRange(BuildFacelets("White", Colors.White));
      facelets.Rotate(Directions.Up, 180);
      facelets.AddRange(BuildFacelets("Yellow", Colors.Yellow));
      facelets.Rotate(Directions.Right, -90);
      var cube = new Cube(facelets);
      facelets.ForEach(f => f.Build(cube));
      return cube;
 }