@mattflow/sudoku-solver

Simple sudoku solver

Stats

StarsIssuesVersionUpdatedCreatedSize
@mattflow/sudoku-solver
312.2.02 years ago5 years agoMinified + gzip package size for @mattflow/sudoku-solver in KB

Readme

Sudoku Solver

Simple, fast sudoku solver.

See it in action here: mattflow.github.io/sudoku-solver

Build Status Coverage Status

Installation

npm install --save @mattflow/sudoku-solver

or

yarn add @mattflow/sudoku-solver

Simple Usage

Accepts a string or array of 81 elements with 0 representing an empty box.

Returns a string containing the solved puzzle.

var solve = require('@mattflow/sudoku-solver');
var puzzle = '000001200100700045000430700090006300050807020006200090003019000970004006002500000';
var solution = solve(puzzle);
console.log(solution);
// 745981263138762945629435718297156384354897621816243597583619472971324856462578139

solve(puzzle, options)

puzzle: A string or array of 81 elements with 0 representing an empty box.

options: An optional object containing configurations.

  • emptyValue: Value representing an empty box. Default: '0'
  • hintCheck: Boolean determining if a hint check is performed. Default: true
  • outputArray: Boolean determining if an array is returned instead of a string. Default: false
  • maxIterations: Value determining the maximum number of iterations before exiting. 0 to disable. Default: 1000000

Running Tests

npm test

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.