| 115 | |
| 116 | |
| 117 | def area_to_xy(area, subarea): |
| 118 | area -= 1 |
| 119 | row, col = area // cols, area % cols |
| 120 | x_0, y_0 = col * (width // cols), row * (height // rows) |
| 121 | if subarea == "top-left": |
| 122 | x, y = x_0 + (width // cols) // 4, y_0 + (height // rows) // 4 |
| 123 | elif subarea == "top": |
| 124 | x, y = x_0 + (width // cols) // 2, y_0 + (height // rows) // 4 |
| 125 | elif subarea == "top-right": |
| 126 | x, y = x_0 + (width // cols) * 3 // 4, y_0 + (height // rows) // 4 |
| 127 | elif subarea == "left": |
| 128 | x, y = x_0 + (width // cols) // 4, y_0 + (height // rows) // 2 |
| 129 | elif subarea == "right": |
| 130 | x, y = x_0 + (width // cols) * 3 // 4, y_0 + (height // rows) // 2 |
| 131 | elif subarea == "bottom-left": |
| 132 | x, y = x_0 + (width // cols) // 4, y_0 + (height // rows) * 3 // 4 |
| 133 | elif subarea == "bottom": |
| 134 | x, y = x_0 + (width // cols) // 2, y_0 + (height // rows) * 3 // 4 |
| 135 | elif subarea == "bottom-right": |
| 136 | x, y = x_0 + (width // cols) * 3 // 4, y_0 + (height // rows) * 3 // 4 |
| 137 | else: |
| 138 | x, y = x_0 + (width // cols) // 2, y_0 + (height // rows) // 2 |
| 139 | return x, y |
| 140 | |
| 141 | |
| 142 | while round_count < configs["MAX_ROUNDS"]: |