Class Index | File Index

Classes


Class SudokuSolver


Defined in: SudokuSolver.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Applies the dancing-links network to solve Sudoku problems.
Method Summary
Method Attributes Method Name and Description
 
fix(selection, cellNo, an)
Sets some numbers in a sudoku grid to be fixed.
 
showBoard(str)
Adds line breaks and other characters into a string to show sudoku boards in a slightly nicer way.
 
solve(puzzle, maxSolutions, maxTime)
Solves a puzzle passed in in a string format, with .
Class Detail
SudokuSolver()
Applies the dancing-links network to solve Sudoku problems.
Method Detail
fix(selection, cellNo, an)
Sets some numbers in a sudoku grid to be fixed.
Parameters:
{number} selection
the value that is in fixed in the sudoku problem. Must be 1-9.
{number} cellNo
the number of the cell that is fixed to this value. Must be 0-80.
{CircularList[]} an
array to which is added any nodes that were hidden during this fixing. this is so that a number of fixing operations can easily be reversed after solving this puzzle.

showBoard(str)
Adds line breaks and other characters into a string to show sudoku boards in a slightly nicer way.
Parameters:
{String} str
a string representation of a sudoku board.

solve(puzzle, maxSolutions, maxTime)
Solves a puzzle passed in in a string format, with ., 0 or space indicating unfilled squares. e.g.
".6.3..8.4537.9.....4...63.7.9..51238.........71362..4.3.64...1.....6.5231.2..9.8."
Parameters:
{String} puzzle
a string representation of a sudoku puzzle. May not be null.
{number} maxSolutions Optional
the maximum number of solutions to find. Will attempt to find all solutions if not set.
{number} maxTime Optional
the maximum time in milliseconds to spend looking for solutions. Will not have a time limit if not set.

Documentation generated by JsDoc Toolkit 2.4.0 on Sat Aug 19 2017 12:52:27 GMT+0000 (UTC)