We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The text was updated successfully, but these errors were encountered:
self.current_player = "♤" self.board = [" " for _ in range(9)] self.buttons = [] for i in range(9): row, col = divmod(i, 3) button = tk.Button(root, text=" ", font=("Helvetica", 24), width=5, height=2, command=lambda i=i: self.on_click(i)) button.grid(row=row, column=col) self.buttons.append(button)
def on_click(self, index): if self.board[index] == " ": self.board[index] = self.current_player self.buttons[index].config(text=self.current_player) if self.check_winner(): messagebox.showinfo("Game Over", f"Player {self.current_player} wins!") self.reset_game() elif " " not in self.board: messagebox.showinfo("Game Over", "It's a draw!") self.reset_game() else: self.current_player = "♤" if self.current_player == "♡" else "♡"
def check_winner(self): win_patterns = [(0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)]
for pattern in win_patterns: if self.board[pattern[0]] == self.board[pattern[1]] == self.board[pattern[2]] != " ": return True return False
def reset_game(self): self.board = [" " for _ in range(9)] for button in self.buttons: button.config(text=" ") self.current_player = "♤"
Sorry, something went wrong.
https://github.com/Limour-dev/kivy-launcher/releases/tag/test
No branches or pull requests
The text was updated successfully, but these errors were encountered: