Skip to content

typescript sudoku。library build by rollup,support with cmd、umd、esm

License

Notifications You must be signed in to change notification settings

happy-func/sudoku.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sudoku

version typescript umd esm cmd npm bundle size (version) GitHub Repo stars

Live Demo

demo

Usage

In Browser

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);

Install

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 });

type

enum Level {
    LOW,
    MIDDLE,
    HIGH
}

type sudokuList = number[][];

interface genOptions {
    mask?: boolean;
    gzip?: boolean;
    level?: Level;
}

Methods

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

Support By

Jetbrains