Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleanup: storing sudokus in arrays instead of separate variables

  • Loading branch information...
commit 21b51473ec0784248a1f28457af8177b5f81e7ca 1 parent 21eab02
@avdg authored
Showing with 7 additions and 11 deletions.
  1. +7 −11 test.py
View
18 test.py
@@ -7,7 +7,7 @@
Executes testdata
"""
def main():
- sudoku1 = [
+ sudokus = [
[8, 9, 0, 1, 0, 4, 0, 2, 0],
[0, 0, 1, 0, 6, 7, 0, 0, 0],
[0, 0, 0, 0, 0, 2, 9, 5, 1],
@@ -17,8 +17,7 @@ def main():
[0, 0, 0, 0, 0, 0, 5, 0, 4],
[6, 0, 7, 5, 0, 0, 0, 0, 0],
[4, 8, 0, 0, 0, 9, 0, 3, 6],
- ]
- sudoku2 = [
+ ], [
[0, 8, 0, 0, 0, 0, 4, 0, 0],
[0, 0, 0, 6, 0, 0, 0, 0, 2],
[1, 0, 0, 0, 0, 9, 0, 0, 0],
@@ -28,8 +27,7 @@ def main():
[0, 0, 0, 0, 0, 3, 0, 6, 0],
[0, 0, 0, 0, 0, 7, 0, 0, 0],
[3, 2, 0, 0, 8, 0, 1, 5, 0],
- ]
- sudoku3 = [
+ ], [
[6, 0, 0, 8, 5, 0, 9, 3, 1],
[3, 5, 8, 0, 0, 0, 0, 6, 0],
[0, 0, 0, 0, 3, 0, 0, 0, 2],
@@ -39,8 +37,7 @@ def main():
[8, 3, 0, 0, 9, 0, 0, 0, 0],
[0, 6, 0, 0, 8, 0, 2, 1, 9],
[1, 0, 9, 0, 0, 5, 0, 0, 3],
- ]
- sudoku4 = [
+ ], [
[0, 0, 7, 0, 1, 3, 0, 0, 6],
[0, 2, 0, 0, 9, 0, 0, 7, 0],
[0, 3, 0, 8, 0, 0, 0, 0, 9],
@@ -51,10 +48,9 @@ def main():
[0, 1, 0, 0, 7, 0, 0, 8, 0],
[5, 0, 0, 6, 4, 0, 7, 0, 0],
]
- solveSudoku(sudoku1)
- solveSudoku(sudoku2)
- solveSudoku(sudoku3)
- solveSudoku(sudoku4)
+
+ for sudoku in sudokus:
+ solveSudoku(sudoku)
"""
Solves a sudoku while displaying some basic debug data
Please sign in to comment.
Something went wrong with that request. Please try again.