Backtracking Algorithm
Solves Easy - Hard Puzzles
#SudokuSolver, #Python, #Backtracking
If your
READMEhas a lot of info, section headers might be nice.
- Enter puzzle row by row, space seperated and use '0' for blank spaces.
#Bactrack Implementation
def solve ():
for y in range(9):
for x in range(9):
if grid[y][x] == 0:
for n in range(1,10):
if check(y,x,n):
grid[y][x] = n
solve()
grid[y][x] = 0
return
printgrid(grid)
#row by row grid
row = 9
grid = []- Clone this repo to your local machine using
https://github.com/grantf28/SudokuSolver/
- Tested With sudoku.com Easy - Hard Puzzles.
- Backtracking is an algorithmic-technique for solving problems recursively by trying to build a solution incrementally, one piece at a time, removing those solutions that fail to satisfy the constraints of the problem at any point of time (by time, here, is referred to the time elapsed till reaching any level of the search tree).
To get started...
-
Option 1
- 🍴 Fork this repo!
-
Option 2
- 👯 Clone this repo to your local machine using
https://github.com/joanaz/HireDot2.git
- 👯 Clone this repo to your local machine using
- HACK AWAY! 🔨🔨🔨
- 🔃 Create a new pull request using
https://github.com/grantf28/SudokuSolver/pulls.
- MIT license
- Copyright 2020 © Grantf28 .