Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moeriki/node-sudokus
A JavaScript utility to solve sudokus.
https://github.com/moeriki/node-sudokus
Last synced: 22 days ago
JSON representation
A JavaScript utility to solve sudokus.
- Host: GitHub
- URL: https://github.com/moeriki/node-sudokus
- Owner: moeriki
- Created: 2016-12-28T23:46:26.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-07-17T07:29:01.000Z (over 5 years ago)
- Last Synced: 2024-12-21T23:36:11.610Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 2.22 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Sudokus
A JavaScript utility to solve sudokus.
## CLI
### Install
```
$ npm install -g sudokus
```### Usage
```shell
$ sudokus solve --help$ sudokus solve ",,,2,9,,1,,,6,,,5,,1,,7,,,,,,,,,3,4,,,,,,,9,4,,4,5,,3,,,,6,2,2,,9,,,4,3,1,,,2,,,,,4,9,,,,6,,,8,,,,,4,3,,2,,,8,7"
$ sudokus solve "[[0,0,0,2,9,0,1,0,0],[6,0,0,5,0,1,0,7,0],[0,0,0,0,0,0,0,3,4],[0,0,0,0,0,0,9,4,0],[4,5,0,3,0,0,0,6,2],[2,0,9,0,0,4,3,1,0],[0,2,0,0,0,0,4,9,0],[0,0,6,0,0,8,0,0,0],[0,4,3,0,2,0,0,8,7]]"
```## API
### Install
```
$ npm install --save sudokus
```### Usage
```javascript
const sudokus = require('sudokus');const solution = sudokus.solve([
[0, 0, 0, 2, 9, 0, 1, 0, 0],
[6, 0, 0, 5, 0, 1, 0, 7, 0],
[0, 0, 0, 0, 0, 0, 0, 3, 4],
[0, 0, 0, 0, 0, 0, 9, 4, 0],
[4, 5, 0, 3, 0, 0, 0, 6, 2],
[2, 0, 9, 0, 0, 4, 3, 1, 0],
[0, 2, 0, 0, 0, 0, 4, 9, 0],
[0, 0, 6, 0, 0, 8, 0, 0, 0],
[0, 4, 3, 0, 2, 0, 0, 8, 7]
]);// solution = [
// [ 7, 8, 4, 2, 9, 3, 1, 5, 6 ],
// [ 6, 3, 2, 5, 4, 1, 8, 7, 9 ],
// [ 5, 9, 1, 6, 8, 7, 2, 3, 4 ],
// [ 3, 1, 7, 8, 6, 2, 9, 4, 5 ],
// [ 4, 5, 8, 3, 1, 9, 7, 6, 2 ],
// [ 2, 6, 9, 7, 5, 4, 3, 1, 8 ],
// [ 8, 2, 5, 1, 7, 6, 4, 9, 3 ],
// [ 9, 7, 6, 4, 3, 8, 5, 2, 1 ],
// [ 1, 4, 3, 9, 2, 5, 6, 8, 7 ]
// ]
```