Beispiel #1
0
        private void FormCross()
        {
            while (!RubixCubeStatusEvaluator.CrossIsFormed(_cube, Side.Front))
            {
                var backEdges = _cube.GetBackEdges().Where(b => b.HasColour(Colour.White)).ToList();
                if (backEdges.Any())
                {
                    var backEdge = backEdges.First();
                    SolveBackEdge(backEdge);
                }

                var frontEdge = GetAnIncorrectFrontEdge();
                if (frontEdge != null)
                {
                    RotateFrontEdgeToBack(frontEdge);
                }

                var sideEdges = _cube.GetSideEdges().Where(b => b.HasColour(Colour.White)).ToList();
                if (sideEdges.Any())
                {
                    var sideEdge = sideEdges.First();
                    RotateSideEdgeToBack(sideEdge);
                }
            }
        }
        public void Solve()
        {
            while (!RubixCubeStatusEvaluator.SecondLayerIsSolved(_cube))
            {
                var backEdges = _cube.GetBackEdges();
                if (backEdges.All(b => b.HasColour(Colour.Yellow)))
                {
                    RotateIncorrectSideEdgeToBack();
                }

                while (GetSolvableEdge() == null)
                {
                    _cube.RotateClockwise(Side.Back);
                }

                SolveBackEdge(GetSolvableEdge());
            }
        }