Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Rec solution in Clear category for Sudoku Solver by Bilou06
# Return the solution of the sudoku.
def checkio(grid):
for i in range(9):
for j in range(9):
if grid[i][j]==0:
for k in range(10):
if (k not in grid[i]) and (k not in zip(*grid)[j]) and (k not in [grid[i/3*3][j/3*3], grid[i/3*3+1][j/3*3], grid[i/3*3+2][j/3*3], grid[i/3*3][j/3*3+1], grid[i/3*3+1][j/3*3+1], grid[i/3*3+2][j/3*3+1], grid[i/3*3][j/3*3+2], grid[i/3*3+1][j/3*3+2], grid[i/3*3+2][j/3*3+2]]):
grid[i][j] = k
if checkio(grid):
return grid
else:
grid[i][j] = 0
else:
return None
return grid
May 26, 2014
Comments: