public void isRedundantCCW() { RotationLinkedList myList = new RotationLinkedList(); myList.addRotation(new Rotation(Face.F, Direction.CCW)); myList.addRotation(new Rotation(Face.F, Direction.CCW)); Assert.AreEqual(true, myList.isRedundant(new Rotation(Face.F, Direction.CCW))); }
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); }
public void testWriteRead() { RotationLinkedList myList = new RotationLinkedList(); myList.addRotation(new Rotation(Face.F, Direction.CW)); myList.addRotation(new Rotation(Face.U, Direction.CCW)); RubikFileWriter myWriter = new RubikFileWriter("writeLinked.txt"); myList.writeToFile(myWriter); myWriter.close(); RubikFileReader myReader = new RubikFileReader("writeLinked.txt"); RotationLinkedList mySecondList = new RotationLinkedList(); mySecondList.readFromFile(myReader); Assert.AreEqual(true, myList.get(0).equals(mySecondList.get(0)), "first"); Assert.AreEqual(true, myList.get(1).equals(mySecondList.get(1)), "first"); }