예제 #1
0
        /// <summary>
        /// Executes the algorithm on the specified cube.
        /// </summary>
        /// <param name="cube"></param>
        public void Execute(Cube cube)
        {
            cube.SetView(View);

            foreach (Move m in Algorithm)
            {
                cube.ExecuteMove(m);
            }
        }
예제 #2
0
 /// <summary>
 /// Changes the current view and adds the current algorithm to the solution.
 /// </summary>
 /// <param name="view">New view</param>
 private void ChangeView(CubeView view)
 {
     if (_currentView.FrontColor != view.FrontColor || _currentView.UpColor != view.UpColor)
     {
         if (_currentAlgorithm.Count > 0)
         {
             Solution.Add(new AlgorithmViewPair(_currentAlgorithm, _currentView));
             _currentAlgorithm = new List <Move>();
         }
         _currentView = view;
         _cube.SetView(view);
     }
 }