-
Notifications
You must be signed in to change notification settings - Fork 0
/
print_sudoku.py
22 lines (20 loc) · 974 Bytes
/
print_sudoku.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from colorama import Fore
from sudoku_input import sudoku_start
def print_sudoku(sudoku_current):
color_matrix = {'border': Fore.BLUE, 'start': Fore.RED, 'solved': Fore.GREEN}
for y in range(0, 9):
row = ''
if y == 3 or y == 6:
print('{color_matrix[border]} -------- + --------- + --------\n'.format(color_matrix=color_matrix))
for x in range(0, 9):
if x == 3 or x == 6:
row += '{color_matrix[border]} | '.format(color_matrix=color_matrix)
if sudoku_current[y][x] == 0:
row += (' ')
elif sudoku_start[y][x] != 0:
row += '{color_matrix[start]} '.format(color_matrix=color_matrix) + (
str(sudoku_current[y][x])) + ' '
else:
row += '{color_matrix[solved]} '.format(color_matrix=color_matrix) + (
str(sudoku_current[y][x])) + ' '
print(row + '\n')