This is a fresh attempt to port Peter Norvig's @norvig legendary Sudoku Solver from an hyper-efficient python base code to JS. See http://norvig.com/sudoku.html for his article and explanations.
The latest js version that port Peter code was from 2014 (thanks to @einaregilsson /sudoku !)
Initially was just create a react app that used Peter Norvig's approach to solve any sudoku puzzle while collecting all steps to learn. But, Peter Norvig used a backtracking search strategy, and what it does is systematically try all possibilities until it hit one that works. In the search of a solution create temp steps that are not valid, making the learning part pointless.
Then I did my research about others sudoku solving strategies, and there are more than 38 options! I was hook. See more here https://www.sudokuwiki.org/sudoku.htm.
But it comes with a caveats: you can produce many lines of code trying to implement some of this strategies and still won't solve all puzzles. (I learned this the hard way). So, here is a mixed approach: Create a react app that use human solving strategies (for learning purposes and because it's fun!) and only apply Peter Norvig's nuclear solver as the last option.
more detail here: https://www.sudokuwiki.org/sudoku.htm
- Hidden Singles SUPPORTED
- Naked Pairs/Triples SUPPORTED
- Pointing Pairs SUPPORTED
- Hidden Pairs/Triples
- Naked/Hidden Quads
- Box/Line Reduction
- X-Wing (Tough Strategies)
- Simple Colouring
- Y-Wing
- Swordfish
- XYZ Wing
- X-Cycles (Diabolical Strategies)
- BUG
- XY-Chain
- 3D Medusa
- Jellyfish
- Unique Rectangles
- SK Loops
- Extended Unique Rect.
- Hidden Unique Rect's
- WXYZ Wing
- Aligned Pair Exclusion
- Exocet (Extreme Strategies)
- Grouped X-Cycles
- Empty Rectangles
- Finned X-Wing
- Finned Swordfish
- Altern. Inference Chains
- Sue-de-Coq
- Digit Forcing Chains
- Nishio Forcing Chains
- Cell Forcing Chains
- Unit Forcing Chains
- Almost Locked Sets
- Death Blossom
- Pattern Overlay Method
- Quad Forcing Chains
- Bowman's Bingo
Last strategy: Backtracking Search SUPPORTED
Feel free to fork this project and open a PR with any improve or new strategy implementation.
This project was bootstrapped with Create React App.
DONE In the modal for Load a new Board, Add a button to select a random puzzle string.
Below you will find some information on how to perform common tasks.
In the project directory, you can run:
Before anything:
After
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
Note: this is a one-way operation. Once you eject
, you can’t go back!
If you aren’t satisfied with the build tool and configuration choices, you can eject
at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject
will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use eject
. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
By default, the generated project uses the latest version of React.
You can refer to the React documentation for more information about supported browsers.