public void TestRandomSolver1()
 {
     Grid g = new Grid(9,10);
     BacktrackingSolver rs = new BacktrackingSolver();
     Grid solution = rs.Solve(g);
     Assert.IsNotNull(solution);
     Assert.AreEqual(solution.GetNumMistakes(), 0);
     Assert.AreEqual(solution.GetNumPlaced(),81);
     Console.WriteLine(g);
 }
Exemplo n.º 2
0
        public static void Main(string[] Args)
        {
            var printer  = new SudokuPrinter();
            var original = Input.Clone() as char[, ];
            var solver   = new BacktrackingSolver(Input);

            printer.Print(original, Input);
            solver.OnCharacterChanged += delegate(int X, int Y)
            {
                printer.Print(original, Input, X, Y);
            };
            var result = solver.Solve();

            Console.WriteLine(solver.Validate() ? $"Sudoku was completed succesfully!" : "Failed to correctly complete sudoku.");
        }