public RotationLinkedList getCopy() { RotationLinkedList l_rotationLinkedList = new RotationLinkedList(); foreach (var l_itr in c_array) { l_rotationLinkedList.addRotation(l_itr as Rotation); } return(l_rotationLinkedList); }
public static void BuildFilesForRotation(RubikFileWriter p_firstFloorFile, RubikFileWriter p_secondFloorFile, RubikFileWriter p_thirdFloorFile , Rubik p_rubik , Permutation p_initialPermutation, RotationLinkedList p_rotationLinkedList, int p_level, String p_progressString) { if (p_level == 0) { return; } if (p_level > 5) { Console.WriteLine(p_progressString); } int i = 0; foreach (Face face in Enum.GetValues(typeof(Face))) { foreach (Direction direction in Enum.GetValues(typeof(Direction))) { i++; String myProgressString = p_progressString + String.Format(".{0}", i); Rotation newRotation = new Rotation(face, direction); if (p_rotationLinkedList.isRedundant(newRotation)) { continue; } p_rotationLinkedList.addRotation(newRotation); p_rubik.rotateFace(newRotation); if (p_rubik.isDifferentItemsInFirstFloorLessThanThree(p_initialPermutation)) { p_rotationLinkedList.writeToFile(p_firstFloorFile); } if (p_rubik.isDifferentItemsOnlyInSecondFloorLessThanThree(p_initialPermutation)) { p_rotationLinkedList.writeToFile((p_secondFloorFile)); } if (p_rubik.changesOnlyInThirdFloor(p_initialPermutation)) { p_rotationLinkedList.writeToFile(p_thirdFloorFile); } BuildFilesForRotation(p_firstFloorFile, p_secondFloorFile, p_thirdFloorFile, p_rubik, p_initialPermutation, p_rotationLinkedList, p_level - 1, myProgressString); p_rotationLinkedList.removeRotation(); p_rubik.rotateFace(newRotation.getReverse()); } } }
public static void loadRotationTreeFromStandard(RotationTree p_tree, RotationLinkedList p_rotationLinkedList, int p_depth) { if (p_depth == 0) { return; } foreach (Face face in Enum.GetValues(typeof(Face))) { foreach (Direction direction in Enum.GetValues(typeof(Direction))) { Rotation newRotation = new Rotation(face, direction); if (p_rotationLinkedList.isRedundant(newRotation)) { continue; } p_rotationLinkedList.addRotation(newRotation); p_tree.addRotationLinkedList(p_rotationLinkedList); loadRotationTreeFromStandard(p_tree, p_rotationLinkedList, p_depth - 1); p_rotationLinkedList.removeRotation(); } } }