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); }
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; }