Locally…
<script src="sudoku.js"></script>
… or Directly from CDN. In which case you don't even need to install.
<script src="https://unpkg.com/js-sudoku@latest/dist/index.js"></script>
// generate sudokuList to show
const list = sudoku.gen({ gzip: false, mask: false, level: sudoku.Level.LOW });
// verify users result
const isValid = sudoku.verify(list);
npm install js-sudoku
# or
yarn add js-sudoku
es model...
import { gen, Level } from 'js-sudoku';
const list = gen({ gzip: false, mask: false, level: Level.LOW });
...node
const { gen, Level } = require('js-sudoku');
const list = gen({ gzip: false, mask: false, level: Level.LOW });
enum Level {
LOW,
MIDDLE,
HIGH
}
type sudokuList = number[][];
interface genOptions {
mask?: boolean;
gzip?: boolean;
level?: Level;
}
gen: (opt: genOptions) => sudokuList | string;
params | type | description |
---|---|---|
mask | boolean | random position fill 0 |
gzip | boolean | gzip result |
level | Level | degree of difficulty working when mask |
verify: (list: sudokuList) => boolean;
params | type | description |
---|---|---|
list | sudokuList | none |