From 41d2d462782500d5976ab9052c573da6cea410a4 Mon Sep 17 00:00:00 2001 From: Derek Hoogewerf <58857663+derek-hoogewerf@users.noreply.github.com> Date: Sat, 4 Apr 2020 01:11:18 +0530 Subject: [PATCH 1/2] Update solver.py integrated with GUI.py --- solver.py | 53 +---------------------------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/solver.py b/solver.py index d9dd558..32dbd7f 100644 --- a/solver.py +++ b/solver.py @@ -1,50 +1,4 @@ -board = [ - [7,8,0,4,0,0,1,2,0], - [6,0,0,0,7,5,0,0,9], - [0,0,0,6,0,1,0,7,8], - [0,0,7,0,4,0,2,6,0], - [0,0,1,0,5,0,9,3,0], - [9,0,4,0,6,0,0,0,5], - [0,7,0,3,0,0,0,1,2], - [1,2,0,0,0,7,4,0,0], - [0,4,9,2,0,6,0,0,7] -] - -def print_board(bo): - for i in range(len(bo)): - if i % 3 == 0 and i != 0: - print("- - - - - - - - - - - - - ") - - for j in range(len(bo[0])): - if j % 3 == 0 and j != 0: - print(" | ", end="") - - if j == 8: - print(bo[i][j]) - else: - print(str(bo[i][j]) + " ", end="") - - -def find_empty(bo): - for i in range(len(bo)): - for j in range(len(bo[0])): - if bo[i][j] == 0: - return (i, j) # row, col - - return None - -board = [ - [0,0,0,0,3,0,0,0,0], - [0,6,5,0,1,0,4,7,0], - [8,3,0,0,0,0,0,6,9], - [0,0,2,3,9,5,8,0,0], - [0,0,1,0,0,0,6,0,0], - [0,0,3,6,4,1,5,0,0], - [4,2,0,0,0,0,0,5,1], - [0,7,9,0,5,0,3,2,0], - [0,0,0,0,2,0,0,0,0] -] - +# solver.py def solve(bo): find = find_empty(bo) @@ -110,8 +64,3 @@ def find_empty(bo): return (i, j) # row, col return None - -print_board(board) -solve(board) -print("___________________") -print_board(board) From b86d1e3d69c37a3803a163e580fc6131dc030ec9 Mon Sep 17 00:00:00 2001 From: Derek Hoogewerf Date: Sat, 4 Apr 2020 01:28:54 +0530 Subject: [PATCH 2/2] added file --- .vscode/launch.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..c837147 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Module", + "type": "python", + "request": "launch", + "module": "sudoku-solver" + } + ] +} \ No newline at end of file