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)

Hierarchy

  • Board

Constructors

  • Creates board object if valid, otherwise throws error

    Parameters

    • board: string

      81 length board string (left to right, top to bottom)

    Returns Board

  • Creates board object if valid, otherwise throws error

    Parameters

    • board: string

      81 length board string (left to right, top to bottom)

    • algorithm: StrategyEnum[]

      specific order to apply strategies

    Returns Board

Properties

board: string[][]
difficulty: number
drills: number[]
givensCount: number
solution: string[][]
solutionString: string
solver: Solver
strategies: boolean[]

Methods

  • Get board array

    Returns

    board array

    Returns string[][]

  • Get difficulty

    Returns

    difficulty

    Returns number

  • Returns 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)

    Returns

    boolean array representing strategies that can be used as the first step in solving this board

    Returns boolean[]

  • Get drills

    Returns

    drills

    Returns number[]

  • Get givensCount

    Returns

    number of givens

    Returns number

  • Get solution array

    Returns

    solution array

    Returns string[][]

  • Returns if given Sudoku board is unsolvable, uniquely solvable, or has multiple solutions using recursive algorithm

    Returns

    0 if unsolvable, 1 if uniquely solvable, 2 if multiple solutions

    Parameters

    • row: number

      row to start at

    • col: number

      column to start at

    • board: string[][]

      2d board array to solve

    • solutions: number

      number of solutions found so far

    Returns number

  • Get solution string

    Returns

    solution string

    Returns string

  • Get boolean array containing strategies used by Solver

    Returns

    strategies boolean array

    Returns boolean[]

  • Returns if given value is a possible candidate at given position taking into account row/column/box constraints

    Returns

    true if value is a possible candidate, false otherwise

    Parameters

    • row: number

      row to check

    • col: number

      column to check

    • value: string

      value to check

    • board: string[][]

      2d board array to check

    Returns boolean

  • Sets solution string

    Returns void

  • Solves the puzzle and sets strategy and solution

    Returns void

  • Determines if the input board is a valid Sudoku board

    Throws

    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)

    Parameters

    • board: string

      81 length board string (left to right, top to bottom)

    Returns boolean

Generated using TypeDoc