MCPcopy Create free account
hub / github.com/ndleah/python-mini-project / draw_board

Function draw_board

Connect-Four/main.py:49–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47 return count
48
49def draw_board():
50 canvas.delete("all") # Clear previous drawings
51
52 cell_size = 50
53 for row in range(ROWS):
54 for col in range(COLS):
55 x1, y1 = col * cell_size, row * cell_size
56 x2, y2 = x1 + cell_size, y1 + cell_size
57
58 color = "white" if board[row][col] == EMPTY else ("red" if board[row][col] == PLAYER_1 else "yellow")
59 canvas.create_oval(x1, y1, x2, y2, fill=color)
60
61def reset_board():
62 global board, current_player

Callers 3

drop_pieceFunction · 0.85
reset_boardFunction · 0.85
main.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected