0.0.4 • Published 4 years ago
@never-rare/sudoku v0.0.4
Sudoku
A yet another simple Sudoku generator and solver for Node.js and browser.
Installation
npm i @never-rare/sudoku
Importing
// CommonJS
const Sudoku = require("@never-rare/sudoku").default;
// ES Module
import Sudoku from "@never-rare/sudoku";
Usage
Generating
const sudoku = new Sudoku;
sudoku.generate();
sudoku.generateBlank(40);
console.log(sudoku.toString());
Solving
const sudoku = new Sudoku(`
- - 8 - 1 2 - 3 -
- 3 1 - 5 - - 7 -
- - - - 6 - 4 - 9
3 2 - - - 9 - 8 -
- - - 5 - 8 - - -
- 7 - 4 - - - 5 2
1 - 7 - 9 - - - -
- 8 - - 4 - 7 9 -
- 4 - 3 8 - 6 - -
`);
sudoku.solve();
console.log(sudoku.toString());