generated from SverreNystad/template_python_application
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
27 lines (22 loc) · 832 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
""" The main entrypoint for the application. """
from src.sudoku_solver.sudoku_utils import create_sudoku_csp, print_sudoku_solution
from src.sudoku_solver.visualization import generate_sudoku_image
EASY = "data/easy.txt"
MEDIUM = "data/medium.txt"
HARD = "data/hard.txt"
VERY_HARD = "data/veryhard.txt"
SUPER_HARD = "data/superhard.txt"
def solve_sudoku(filename, title):
print("Sudoku from file: " + filename)
sudoku = create_sudoku_csp(filename)
solution = sudoku.backtracking_search()
sudoku.print_stats()
print_sudoku_solution(solution)
generate_sudoku_image(solution, title)
print("")
if __name__ == "__main__":
solve_sudoku(EASY, "EASY")
solve_sudoku(MEDIUM, "MEDIUM")
solve_sudoku(HARD, "HARD")
solve_sudoku(VERY_HARD, "VERY_HARD")
solve_sudoku(SUPER_HARD, "SUPER_HARD")