Global

Methods

solutionGenerator(matrix, optionsopt) → {Solution}

Source:
Creates an ES2015 Generator object that can be used to iterate over the solutions to the matrix. This is a convenience function which avoids having to create an instance of the Dlx class. It is useful if you are not interested in handling any events.
Parameters:
Name Type Attributes Description
matrix Matrix The matrix to be solved.
options object <optional>
Optional options object.
Properties
Name Type Description
numPrimaryColumns number The number of primary columns. By default, all columns are primary. Any remaining columns are considered to be secondary columns.
Yields:
The next solution.
Type
Solution

solve(matrix, optionsopt) → {Array.<Solution>}

Source:
Solves the matrix and returns an array of solutions. This is a convenience function which avoids having to create an instance of the Dlx class. It is useful if you are not interested in handling any events.
Parameters:
Name Type Attributes Description
matrix Matrix The matrix to be solved.
options object <optional>
Optional options object.
Properties
Name Type Description
numSolutions number The number of solutions to be returned. By default, all solutions are returned.
numPrimaryColumns number The number of primary columns. By default, all columns are primary. Any remaining columns are considered to be secondary columns.
Returns:
The solutions that were found.
Type
Array.<Solution>

Type Definitions

Matrix

Source:
A matrix is an array of MatrixRow.
Type:

MatrixRow

Source:
A matrix row is an array of MatrixValue.
Type:

MatrixValue

Source:
Matrix values can be of any type. Anything truthy is treated as a 1. Anything falsy is treated as a 0.
Type:
  • *

PartialSolution

Source:
The indices of the matrix rows that comprise a partial solution.
Type:
  • Array.<number>

Solution

Source:
The indices of the matrix rows that comprise a complete solution.
Type:
  • Array.<number>