public void positionTest() { Rubik myRubik = new Rubik(); myRubik.rotateFace(new Rotation(Face.U, Direction.CW)); Assert.AreEqual(true, myRubik .getPositionOfCubicleOfCubiclePlace(new Location(Face.D, Face.F)) .equals(new Position(Face.U, Face.F)), "1"); myRubik.rotateFace(new Rotation(Face.R, Direction.CW)); Assert.AreEqual(true, myRubik .getPositionOfCubicleOfCubiclePlace(new Location(Face.D, Face.F)) .equals(new Position(Face.U, Face.F)), "2"); myRubik.rotateFace(new Rotation(Face.L, Direction.CW)); Assert.AreEqual(true, myRubik .getPositionOfCubicleOfCubiclePlace(new Location(Face.D, Face.F)) .equals(new Position(Face.U, Face.F)), "3"); Position yaki = myRubik.getPositionOfCubicleOfCubiclePlace(new Location(Face.D, Face.L)); myRubik.rotateFace(new Rotation(Face.D, Direction.CW)); yaki = myRubik.getPositionOfCubicleOfCubiclePlace(new Location(Face.D, Face.F)); Assert.AreEqual(true, myRubik .getPositionOfCubicleOfCubiclePlace(new Location(Face.D, Face.F)) .equals(new Position(Face.B, Face.L)), "4"); }
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 rotateTest3() { Rubik myRubik = new Rubik(); myRubik.rotateFace(new Rotation(Face.D, Direction.CCW)); Assert.AreEqual(true, (new Location(Face.D, Face.R, Face.B)) .equals(myRubik.getOriginalLocationOfCurrentCubicleInLocation(new Location(Face.D, Face.R, Face.F)))); }
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"); }
public void setPermutationTest() { Permutation myPermutation = new Permutation(); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.F, Face.U), new Location(Face.F, Face.U), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.F, Face.R), new Location(Face.F, Face.R), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.F, Face.L), new Location(Face.F, Face.L), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.F, Face.D), new Location(Face.F, Face.D), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.B, Face.U), new Location(Face.B, Face.U), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.B, Face.R), new Location(Face.B, Face.R), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.B, Face.L), new Location(Face.B, Face.L), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.B, Face.D), new Location(Face.B, Face.D), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.U, Face.R), new Location(Face.U, Face.R), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.U, Face.L), new Location(Face.U, Face.L), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.D, Face.R), new Location(Face.D, Face.R), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.D, Face.L), new Location(Face.D, Face.L), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.F, Face.U, Face.R), new Location(Face.F, Face.U, Face.R), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.F, Face.U, Face.L), new Location(Face.F, Face.U, Face.L), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.F, Face.D, Face.R), new Location(Face.F, Face.D, Face.R), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.F, Face.D, Face.L), new Location(Face.F, Face.D, Face.L), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.B, Face.U, Face.R), new Location(Face.B, Face.U, Face.R), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.B, Face.U, Face.L), new Location(Face.B, Face.U, Face.L), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.B, Face.D, Face.R), new Location(Face.B, Face.D, Face.R), new Position(Face.U, Face.F))); myPermutation.addCubicleData(new CubeCubicle(new Location(Face.B, Face.D, Face.L), new Location(Face.B, Face.D, Face.L), new Position(Face.U, Face.F))); Rubik myRubik = new Rubik(); myRubik.rotateFace(new Rotation(Face.R, Direction.CW)); myRubik.rotateFace(new Rotation(Face.B, Direction.CW)); myRubik.rotateFace(new Rotation(Face.R, Direction.CW)); myRubik.rotateFace(new Rotation(Face.B, Direction.CW)); myRubik.rotateFace(new Rotation(Face.L, Direction.CW)); myRubik.rotateFace(new Rotation(Face.F, Direction.CW)); myRubik.rotateFace(new Rotation(Face.R, Direction.CW)); myRubik.rotateFace(new Rotation(Face.B, Direction.CW)); myRubik.rotateFace(new Rotation(Face.R, Direction.CW)); myRubik.setPermutation(myPermutation); AssistAssertRubik.checkEntireCube(myRubik); }
public void simpleRotations() { Rubik myRubik = new Rubik(); for (int i = 0; i < 20; i++) { 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)); myRubik.rotateFace(new Rotation(Face.R, Direction.CW)); myRubik.rotateFace(new Rotation(Face.U, Direction.CW)); myRubik.rotateFace(new Rotation(Face.R, Direction.CW)); myRubik.rotateFace(new Rotation(Face.B, Direction.CW)); myRubik.rotateFace(new Rotation(Face.L, Direction.CW)); myRubik.rotateFace(new Rotation(Face.F, Direction.CW)); } for (int i = 0; i < 20; i++) { myRubik.rotateFace(new Rotation(Face.F, Direction.CCW)); myRubik.rotateFace(new Rotation(Face.L, Direction.CCW)); myRubik.rotateFace(new Rotation(Face.B, Direction.CCW)); myRubik.rotateFace(new Rotation(Face.R, Direction.CCW)); myRubik.rotateFace(new Rotation(Face.U, Direction.CCW)); myRubik.rotateFace(new Rotation(Face.R, Direction.CCW)); myRubik.rotateFace(new Rotation(Face.D, Direction.CCW)); myRubik.rotateFace(new Rotation(Face.L, Direction.CCW)); myRubik.rotateFace(new Rotation(Face.R, Direction.CCW)); myRubik.rotateFace(new Rotation(Face.U, Direction.CCW)); } myRubik.rotateFace(new Rotation(Face.F, Direction.CW)); myRubik.rotateFace(new Rotation(Face.F, Direction.CCW)); AssistAssertRubik.checkEntireCube(myRubik); }