static void Main(string[] args) { sudokuAlgorithm algorithmMethod; bool loopFlag = true; while (loopFlag) { Console.WriteLine("\n\nPlease enter one of the following options:"); Console.WriteLine("=========================================="); Console.WriteLine("a) Run naive Dancing Links algorithm"); Console.WriteLine("b) Run imporoved Dancing Links algorithm"); Console.WriteLine("c) Run Backtracking algorithm"); Console.WriteLine("x) Exit"); String userInput = Console.ReadLine(); switch (userInput.ToLower()) { case "a": algorithmMethod = new sudokuNaiveDancingLinksAlgorithm(); algorithmMethod.solvePuzzle(); break; case "b": algorithmMethod = new sudokuDancingLinksAlgorithm(); algorithmMethod.solvePuzzle(); break; case "c": algorithmMethod = new sudokuRecursiveAlgorithm(); algorithmMethod.solvePuzzle(); break; case "x": loopFlag = false; break; default: Console.WriteLine("You selected an invalid option, please try again!\n\n"); break; } } //sudokuBacktrackingAlgorithm sba = new sudokuBacktrackingAlgorithm(); //sba.solvePuzzle(); //sudokuDancingLinksAlgorithm sdla = new sudokuDancingLinksAlgorithm(); //sdla.solvePuzzle(); }
public void testNaiveDLAlgorithm_solvePuzzle_invalid() { sudokuAlgorithm algorithmMethod = new sudokuNaiveDancingLinksAlgorithm(); Assert.IsFalse(algorithmMethod.solvePuzzle("puzzleWithBadFormat.txt")); }
public void testNaiveDLAlgorithm_solvePuzzle_valid() { sudokuAlgorithm algorithmMethod = new sudokuNaiveDancingLinksAlgorithm(); Assert.IsTrue(algorithmMethod.solvePuzzle("4x4.txt")); }