Пример #1
0
        public void simpleSolver()
        {
            Rubik myRubik = new Rubik();

            myRubik.rotateFace(new Rotation(Face.U, Direction.CW));
            myRubik.rotateFace(new Rotation(Face.R, Direction.CW));
            myRubik.rotateFace(new Rotation(Face.L, Direction.CW));
            myRubik.rotateFace(new Rotation(Face.D, Direction.CW));
            RotationTree       myTree = new RotationTree();
            RotationLinkedList myRotationLinkedList = new RotationLinkedList();

            myRotationLinkedList.addRotation(new Rotation(Face.U, Direction.CCW));
            myTree.addRotationLinkedList(myRotationLinkedList);

            myRotationLinkedList = new RotationLinkedList();
            myRotationLinkedList.addRotation(new Rotation(Face.R, Direction.CCW));
            myTree.addRotationLinkedList(myRotationLinkedList);

            myRotationLinkedList = new RotationLinkedList();
            myRotationLinkedList.addRotation(new Rotation(Face.L, Direction.CCW));
            myTree.addRotationLinkedList(myRotationLinkedList);

            myRotationLinkedList = new RotationLinkedList();
            myRotationLinkedList.addRotation(new Rotation(Face.D, Direction.CCW));
            myTree.addRotationLinkedList(myRotationLinkedList);

            Solver   mySolver   = new Solver();
            Solution mySolution = mySolver.solve(myRubik, myTree, myTree, myTree);

            mySolution.applyToRubik(myRubik);
            mySolution.print();
            myRubik.getPermutation().print();
            AssistAssertRubik.checkEntireCube(myRubik);
        }
Пример #2
0
        public void getValue()
        {
            Rubik myRubik = new Rubik();

            myRubik.rotateFace(new Rotation(Face.F, Direction.CW));
            Permutation myPermutation = myRubik.getPermutation();

            Assert.AreEqual(10, myPermutation.getValue(1), "first floor");
            Assert.AreEqual(14, myPermutation.getValue(2), "second floor");
            Assert.AreEqual(24, myPermutation.getValue(3), "third floor");
        }