Evaluate the board and update the global Game status.
()
| 60 | |
| 61 | |
| 62 | def check_win() -> None: |
| 63 | """Evaluate the board and update the global Game status.""" |
| 64 | global Game |
| 65 | # Winning combinations |
| 66 | combos = [ |
| 67 | (1, 2, 3), |
| 68 | (4, 5, 6), |
| 69 | (7, 8, 9), |
| 70 | (1, 4, 7), |
| 71 | (2, 5, 8), |
| 72 | (3, 6, 9), |
| 73 | (1, 5, 9), |
| 74 | (3, 5, 7), |
| 75 | ] |
| 76 | for a, b, c in combos: |
| 77 | if board[a] == board[b] == board[c] != " ": |
| 78 | Game = Win |
| 79 | return |
| 80 | if all(board[i] != " " for i in range(1, 10)): |
| 81 | Game = Draw |
| 82 | else: |
| 83 | Game = Running |
| 84 | |
| 85 | |
| 86 | def main() -> None: |