Creates board object if valid, otherwise throws error
81 length board string (left to right, top to bottom)
Creates board object if valid, otherwise throws error
81 length board string (left to right, top to bottom)
specific order to apply strategies
Private boardPrivate difficultyPrivate drillsPrivate givensPrivate solutionPrivate solutionPrivate solverPrivate strategiesPrivate getReturns a boolean array representing strategies that can be used as the first step in solving this board If a strategies prereqs are included then it is excluded in order to ensure good examples of strategies are used For example, if there is a obvious pair made up of two obvious singles only the obvious single will be used as a drill Excludes amend and simplify notes as well as any strategies past hidden quadruplet in StrategyEnum (so index 0 is obvious single and index 9 is hidden quadruplet)
boolean array representing strategies that can be used as the first step in solving this board
Private getGiven a strategy returns an array containing its prereqs
array of prereqs for the given strategy
strategy getting prereqs for
Private getReturns if given Sudoku board is unsolvable, uniquely solvable, or has multiple solutions using recursive algorithm
0 if unsolvable, 1 if uniquely solvable, 2 if multiple solutions
row to start at
column to start at
2d board array to solve
number of solutions found so far
Private isReturns if given value is a possible candidate at given position taking into account row/column/box constraints
true if value is a possible candidate, false otherwise
row to check
column to check
value to check
2d board array to check
Private setSets difficulty using combined refutation and dependency scores Inspired by https://www.fi.muni.cz/~xpelanek/publications/flairs-sudoku.pdf
Private setPrivate solveDetermines if the input board is a valid Sudoku board
CustomError Thrown if board has invalid length, characters, duplicate values, is already solved, is unsolvable, or has multiple solutions in a row, column, or box (Excluding zeros)
81 length board string (left to right, top to bottom)
Generated using TypeDoc
Constructed using board string Throws exception if invalid board Returns: Board (2d array, one array per row each containing one string per cell) Solution (2d array or string) Most complex strategy that could be needed to solve Difficulty (integer on scale)