MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / generate

Function generate

projects/Sudoku-Solver/SudokuGUI.py:13–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11
12
13def generate():
14 while True:
15 for event in pygame.event.get():
16 if event.type == pygame.QUIT:
17 exit()
18 board = [[0 for i in range(9)] for j in range(9)]
19
20 for i in range(9):
21 for j in range(9):
22 if random.randint(1, 10) >= 5:
23 board[i][j] = random.randint(1, 9)
24 if valid(board, (i, j), board[i][j]):
25 continue
26 else:
27 board[i][j] = 0
28 partialBoard = deepcopy(board)
29 if solve(board):
30 return partialBoard
31
32
33class Board:

Callers 1

__init__Method · 0.85

Calls 3

validFunction · 0.90
solveFunction · 0.90
exitFunction · 0.85

Tested by

no test coverage detected