Human move and AI response.
(row: int, col: int)
| 83 | |
| 84 | |
| 85 | def make_move(row: int, col: int) -> None: |
| 86 | """Human move and AI response.""" |
| 87 | if board[row][col] != " ": |
| 88 | messagebox.showerror("Error", "Invalid move") |
| 89 | return |
| 90 | board[row][col] = "X" |
| 91 | buttons[row][col].configure(text="X") |
| 92 | if check_winner(board, "X"): |
| 93 | messagebox.showinfo("Tic-Tac-Toe", "You win!") |
| 94 | root.quit() |
| 95 | elif is_board_full(board): |
| 96 | messagebox.showinfo("Tic-Tac-Toe", "Draw!") |
| 97 | root.quit() |
| 98 | else: |
| 99 | ai_move() |
| 100 | |
| 101 | |
| 102 | def ai_move() -> None: |
no test coverage detected