-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsolve.py
57 lines (38 loc) · 1.17 KB
/
solve.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""
Sudoku Generator
© Atomic Sorcerer 2022
"""
from lib.utils import complete_board, print_board
from board.board import Board
import sys
show_build_process = False
do_highlight = False
try:
if sys.argv.count("--show_process") > 0:
show_build_process = True
except IndexError:
pass
try:
if sys.argv.count("--do_highlight") > 0:
do_highlight = True
except IndexError:
pass
indexes_to_collapse = []
def add_a_coord():
print("---")
x = int(input("Enter the 'x' coordinate: "))
y = int(input("Enter the 'y' coordinate: "))
value = int(input("Enter value to collapse tile to: "))
coords = (x, y)
indexes_to_collapse.append((coords, value))
add_more = input("Do you want to collapse more tiles (y, N): ")
if add_more == "y":
add_a_coord()
if __name__ == "__main__":
add_a_coord()
board = Board()
for i in indexes_to_collapse:
board.collapse_specific_tile(i[0][0], i[0][1], i[1], do_highlight=do_highlight)
new_board = complete_board(board, show_process=show_build_process)
print(f"Iteration Amount: {str(new_board[1])}")
print(f"Attempts to create board: {str(new_board[2])}")