コード例 #1
0
        public bool Solve()
        {
            //open digits method
            OpenDigitsEngine engine1 = new OpenDigitsEngine(field);

            engine1.Start();
            if (correctSolution())
            {
                return(true);
            }
            //hidden digits method

            //backtracking method
            BacktrackingEngine engine3 = new BacktrackingEngine(field);

            engine3.Start();
            if (correctSolution())
            {
                return(true);
            }

            if (!correctSolution())
            {
                throw new Exception("Cannot solve current sudoku or incorrect input.");
            }
            return(false);
        }
コード例 #2
0
ファイル: Solver.cs プロジェクト: bmwant/SSO
        public bool Solve()
        {
            //open digits method
            OpenDigitsEngine engine1 = new OpenDigitsEngine(field);
            engine1.Start();
            if (correctSolution())
            {
                return true;
            }
            //hidden digits method

            //backtracking method
            BacktrackingEngine engine3 = new BacktrackingEngine(field);
            engine3.Start();
            if (correctSolution())
            {
                return true;
            }

            if (!correctSolution())
            {
                throw new Exception("Cannot solve current sudoku or incorrect input.");
            }
            return false;
        }