public void BruteForce_Recursive_FullSolve() { string TestType = "Recursive Brute force "; bool MultipleSolutionsFound = false; //all right, now the real test List <Cell> SolvedCells = BoardTest.SolvedSudokuPuzzle1(); Board UnSolvedBoard = new Board(BoardTest.UnsolvedSudokuPuzzle1()); BruteForceSolver Solver = new BruteForceSolver(); Solver.RecursiveBruteForceSolve(ref UnSolvedBoard, ref MultipleSolutionsFound); Assert.IsTrue(BoardTest.CellListsAreEqual(UnSolvedBoard.Cells, SolvedCells), TestType + "failed to solve the first test board, its result: " + UnSolvedBoard.PrintBoard()); Assert.IsFalse(MultipleSolutionsFound, TestType + "said there were multiple solutions on a board with just one"); SolvedCells = BoardTest.SolvedSudokuPuzzle2(); UnSolvedBoard = new Board(BoardTest.UnsolvedSudokuPuzzle2()); Solver.RecursiveBruteForceSolve(ref UnSolvedBoard, ref MultipleSolutionsFound); Assert.IsTrue(BoardTest.CellListsAreEqual(UnSolvedBoard.Cells, SolvedCells), TestType + "failed to solve the second test board, its result: " + UnSolvedBoard.PrintBoard()); Assert.IsFalse(MultipleSolutionsFound, TestType + "said there were multiple solutions on a board with just one"); }
public void BruteForce_SingleState_FullSolve() { //all right, now the real test List <Cell> SolvedCells = BoardTest.SolvedSudokuPuzzle1(); Board UnSolvedBoard = new Board(BoardTest.UnsolvedSudokuPuzzle1()); BruteForceSolver Solver = new BruteForceSolver(); Solver.SingleStateBruteForceSolve(ref UnSolvedBoard); Assert.IsTrue(BoardTest.CellListsAreEqual(UnSolvedBoard.Cells, SolvedCells), "Brute force failed to solve the first test board, its result: " + UnSolvedBoard.PrintBoard()); SolvedCells = BoardTest.SolvedSudokuPuzzle2(); UnSolvedBoard = new Board(BoardTest.UnsolvedSudokuPuzzle2()); Solver.SingleStateBruteForceSolve(ref UnSolvedBoard); Assert.IsTrue(BoardTest.CellListsAreEqual(UnSolvedBoard.Cells, SolvedCells), "Brute force failed to solve the second test board, its result: " + UnSolvedBoard.PrintBoard()); }