Esempio n. 1
0
 static TurnSequence Solve_Second2CrossEdges(Cube cube, Edge solvedEdge0, Edge solvedEdge1, Edge remainingEdge2, Edge remainingEdge3)
 {
     return(GetStepsToAcheiveMatch(6, new CompoundConstraint(
                                       EdgeConstraint.Stationary(solvedEdge0),
                                       EdgeConstraint.Stationary(solvedEdge1),
                                       FindEdgeAndSolveIt(cube, remainingEdge2),
                                       FindEdgeAndSolveIt(cube, remainingEdge3)
                                       ), new TurnMoveGenerator()));
 }
Esempio n. 2
0
 static IEnumerable <EdgeConstraint> CrossConstraints()
 {
     return(new[] {
         new Edge(Side.Down, Side.Right),
         new Edge(Side.Down, Side.Left),
         new Edge(Side.Down, Side.Back),
         new Edge(Side.Down, Side.Front)
     }.Select(x => EdgeConstraint.Stationary(x)));
 }
Esempio n. 3
0
        public void CanSolveCross(string mixItUpMove)
        {
            var mixItUpTurns = TurnSequence.Parse(mixItUpMove);
            var cube         = new Cube().Apply(mixItUpTurns);

            // When: get cross solution and apply it
            var solution = Solver.GetCrossSolution(cube);

            cube = cube.Apply(solution);

            // Then: cross is solved
            Assert.True(EdgeConstraint.Stationary(new Edge(Side.Front, Side.Down)).IsMatch(cube));
            Assert.True(EdgeConstraint.Stationary(new Edge(Side.Right, Side.Down)).IsMatch(cube));
            Assert.True(EdgeConstraint.Stationary(new Edge(Side.Back, Side.Down)).IsMatch(cube));
            Assert.True(EdgeConstraint.Stationary(new Edge(Side.Left, Side.Down)).IsMatch(cube));
        }