| 82 | |
| 83 | |
| 84 | def draw_board(board): |
| 85 | for c in range(COLUMN_COUNT): |
| 86 | for r in range(ROW_COUNT): |
| 87 | pygame.draw.rect( |
| 88 | screen, |
| 89 | BLUE, |
| 90 | (c * SQUARESIZE, r * SQUARESIZE + SQUARESIZE, SQUARESIZE, SQUARESIZE), |
| 91 | ) |
| 92 | pygame.draw.circle( |
| 93 | screen, |
| 94 | BLACK, |
| 95 | ( |
| 96 | int(c * SQUARESIZE + SQUARESIZE / 2), |
| 97 | int(r * SQUARESIZE + SQUARESIZE + SQUARESIZE / 2), |
| 98 | ), |
| 99 | RADIUS, |
| 100 | ) |
| 101 | |
| 102 | for c in range(COLUMN_COUNT): |
| 103 | for r in range(ROW_COUNT): |
| 104 | if board[r][c] == 1: |
| 105 | pygame.draw.circle( |
| 106 | screen, |
| 107 | RED, |
| 108 | ( |
| 109 | int(c * SQUARESIZE + SQUARESIZE / 2), |
| 110 | height - int(r * SQUARESIZE + SQUARESIZE / 2), |
| 111 | ), |
| 112 | RADIUS, |
| 113 | ) |
| 114 | elif board[r][c] == 2: |
| 115 | pygame.draw.circle( |
| 116 | screen, |
| 117 | YELLOW, |
| 118 | ( |
| 119 | int(c * SQUARESIZE + SQUARESIZE / 2), |
| 120 | height - int(r * SQUARESIZE + SQUARESIZE / 2), |
| 121 | ), |
| 122 | RADIUS, |
| 123 | ) |
| 124 | pygame.display.update() |
| 125 | |
| 126 | |
| 127 | board = create_board() |