public void isRedundantCW() { RotationLinkedList myList = new RotationLinkedList(); myList.addRotation(new Rotation(Face.F, Direction.CW)); Assert.AreEqual(true, myList.isRedundant(new Rotation(Face.F, Direction.CW))); }
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 numberNodesRotationTree() { RotationLinkedList l_rotationLinkedList = new RotationLinkedList(); RotationTree l_tree = new RotationTree(); RotationTreeLoader.loadRotationTreeFromStandard(l_tree, l_rotationLinkedList, 4); // int numberOfNodes = l_tree.getNumberOfNodes(); // Assert.AreEqual(11205, numberOfNodes); }
public void loadRotationTreeFromFile() { RotationLinkedList l_rotationLinkedList = new RotationLinkedList(); RotationTree l_tree = new RotationTree(); forTestRubikFileReader myTestReader = new forTestRubikFileReader("(5,1) (3,1) (1,0) (3,0) (4,0) (3,0) (4,1) (1,1) \r\n" + "(5,1) (3,1) (1,0) (3,0) (5,0) \r\n"); RotationTreeLoader.loadRotationTreeFromFile(myTestReader, l_tree); Assert.AreEqual(Direction.CCW, l_tree.getRotationLinkedList(1).get(0).getDirection()); }
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"); }
public void loadRotationTreeFromStandard() { RotationLinkedList l_rotationLinkedList = new RotationLinkedList(); RotationTree l_tree = new RotationTree(); RotationTreeLoader.loadRotationTreeFromStandard(l_tree, l_rotationLinkedList, 1); int i = -1; foreach (Face face in Enum.GetValues(typeof(Face))) { foreach (Direction direction in Enum.GetValues(typeof(Direction))) { i++; int rotationValue = (new Rotation(face, direction)).getValue(); Assert.AreEqual(face, l_tree.getRotationLinkedList(i).get(0).getFace()); Assert.AreEqual(direction, l_tree.getRotationLinkedList(i).get(0).getDirection()); } } }