https://github.com/albinotonnina/sudoku-solver-backtracking-algorithm
Learning to solve a sudoku with backtracking algorithms
https://github.com/albinotonnina/sudoku-solver-backtracking-algorithm
algorithm algorithm-challenges backtracking-algorithm javascript jest nodejs sudoku tdd
Last synced: 9 months ago
JSON representation
Learning to solve a sudoku with backtracking algorithms
- Host: GitHub
- URL: https://github.com/albinotonnina/sudoku-solver-backtracking-algorithm
- Owner: albinotonnina
- Created: 2017-11-19T14:22:07.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-15T00:31:31.000Z (almost 8 years ago)
- Last Synced: 2025-01-23T08:22:51.215Z (11 months ago)
- Topics: algorithm, algorithm-challenges, backtracking-algorithm, javascript, jest, nodejs, sudoku, tdd
- Language: JavaScript
- Size: 1.66 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
## Sudoku Solver
### Solved with a backtracking algorithm

### Functions
**parseBoard**: Parse the string into a 2D array and convert strings to integers for easier manipulation.
**saveEmptyPositions**: Iterate through the board and save all of the empty positions into an array so we can track which numbers are mutable and keep order to our testing.
**checkRow**, **checkColumn**, **check3x3Square**, **checkValue**: Check the column, row, and current 3x3 square for a match to the current value tested, which can all be called with checkValue.
**solvePuzzle**: Take the parsed Sudoku board and the array of empty positions, and find the solution.
**solveSudoku**: Parse the board, save the empty positions, and pass them to solvePuzzle.
### Install
`npm install`
### Test
`npm run test`
### Start
`npm start`