Package Exports
- sudoku-core
- sudoku-core/dist/cjs/index.js
- sudoku-core/dist/esm/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sudoku-core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Sudoku Core Function
Generate, Solve (step-by-step or all), Analyze Sudoku boards
Explore the docs »
View Demo
.
Report Bug
.
Request Feature
Table Of Contents
Getting Started
Installation
npm install sudoku-core@latest
Usage
import { createSudokuInstance } from "sudoku-core";
Generate Board
// Need to create a Sudoku Instance first
const { getBoard } = createSudokuInstance({ difficulty: "easy" });
// get the generated board
const board = getBoard();
console.log(board);
Output (board)
[
5,
3,
null,
null,
null,
null,
null,
1
//... 81 items
]
Analyze Board
// Need to create a Sudoku Instance first
const { analyze } = createSudokuInstance({ difficulty: "expert" });
// get the generated board
const analyzeData = analyze();
console.log(analyzeData);
Output
{
"finished": true,
"usedStrategies": [
{ "title": "Single Remaining Cell Strategy", "frequency": 21 },
{ "title": "Single Candidate Cell Strategy", "frequency": 11 },
{ "title": "Single Candidate Value Strategy", "frequency": 29 },
{ "title": "Pointing Elimination Strategy", "frequency": 27 }
],
"level": "expert",
"score": 1683.1
}
For more examples, please refer to the Documentation
Roadmap
See the open issues for a list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- If you have suggestions for adding or removing projects, feel free to open an issue to discuss it, or directly create a pull request after you edit the README.md file with necessary changes.
- Please make sure you check your spelling and grammar.
- Create individual PR for each suggestion.
Creating A Pull Request
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'feat: Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE for more information.
Authors
- Komeil Mehranfar - Frontend Engineer at iO