public int[][] Solve(int[][] sudoku)
        {
            LogicalSolver solver = new LogicalSolver(sudoku);

            solver.Solve();

            Debug.Assert(solver.IsCorrect());

            return(solver.ExportSolution());
        }
Example #2
0
        public void SolvePuzzle()
        {
            this.solving = true;

            if (!this.BruteForceSolve)
            {
                LogicalSolver.Solve(this);

                // not solved, do we fall back?
                Debugger.Break();
            }

            else
            {
                LogicalSolver.SetCellValueForNakedSingles(this);

                this.Solved = BruteForceSolver.Solve(this);
                if (!this.Solved)
                {
                    Debugger.Break();
                }
            }
        }