pratikshahp commited on
Commit
f1a1769
·
verified ·
1 Parent(s): dd1d8a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  import random
 
3
  # Check if there's a winner
4
  def check_winner(board):
5
  for row in board:
@@ -84,13 +85,16 @@ def handle_move(board, current_player, button_idx, game_status, difficulty):
84
  # Reset the game
85
  def reset_game():
86
  board = [[""] * 3 for _ in range(3)]
87
- buttons = [gr.Button(value="", elem_classes=["cell-btn"]) for _ in range(9)]
88
- return board, "X", "Player 1's turn (X)", "", *buttons
 
 
 
89
 
90
 
91
  # Initial game setup
92
  board = [[""] * 3 for _ in range(3)]
93
- buttons = [gr.Button(value="", elem_classes=["cell-btn"]) for _ in range(9)]
94
 
95
  with gr.Blocks(css=".cell-btn {height: 100px; width: 100px; font-size: 2em; margin: 5px;}") as app:
96
  gr.Markdown("<h1 style='text-align: center;'>Tic Tac Toe Game</h1>")
 
1
  import gradio as gr
2
  import random
3
+
4
  # Check if there's a winner
5
  def check_winner(board):
6
  for row in board:
 
85
  # Reset the game
86
  def reset_game():
87
  board = [[""] * 3 for _ in range(3)]
88
+ current_player = "X"
89
+ status = "Player 1's turn (X)"
90
+ winner_message = ""
91
+ buttons = [gr.Button(value="", elem_classes=["cell-btn"], interactive=True) for _ in range(9)]
92
+ return board, current_player, status, winner_message, *buttons
93
 
94
 
95
  # Initial game setup
96
  board = [[""] * 3 for _ in range(3)]
97
+ buttons = [gr.Button(value="", elem_classes=["cell-btn"], interactive=True) for _ in range(9)]
98
 
99
  with gr.Blocks(css=".cell-btn {height: 100px; width: 100px; font-size: 2em; margin: 5px;}") as app:
100
  gr.Markdown("<h1 style='text-align: center;'>Tic Tac Toe Game</h1>")