Kaushik Rajan commited on
Commit
47b257f
Β·
1 Parent(s): feb1933

Improve tic-tac-toe layout: move New Game button to header, center stats

Browse files
Files changed (1) hide show
  1. app.py +19 -4
app.py CHANGED
@@ -144,6 +144,15 @@ def create_interface():
144
  opacity: 0.8 !important;
145
  cursor: not-allowed !important;
146
  }
 
 
 
 
 
 
 
 
 
147
  """
148
 
149
  with gr.Blocks(title="SPIRAL: Interactive Reasoning Game Simulator", theme=gr.themes.Soft(), css=css) as demo:
@@ -269,8 +278,14 @@ def create_interface():
269
  tictactoe_env.reset()
270
 
271
  # Simplified layout focusing only on TicTacToe
272
- gr.Markdown("### Play TicTacToe against AI\nYou are ❌ (X) and go first. Click on a square to make your move.")
 
 
 
 
 
273
 
 
274
  with gr.Column(elem_classes=["ttt-board"]):
275
  board_buttons = []
276
  for i in range(3):
@@ -280,9 +295,9 @@ def create_interface():
280
  button = gr.Button("", elem_id=f"ttt-cell-{pos}", size="lg", value="")
281
  board_buttons.append(button)
282
 
283
- with gr.Row():
284
- ttt_reset_btn = gr.Button("New Game", variant="secondary")
285
- ttt_stats_display = gr.Markdown(value="Wins: 0 | Losses: 0 | Draws: 0")
286
 
287
  ttt_message = gr.Textbox(
288
  label="Game Status",
 
144
  opacity: 0.8 !important;
145
  cursor: not-allowed !important;
146
  }
147
+ .ttt-stats {
148
+ text-align: center !important;
149
+ margin: 20px 0 !important;
150
+ font-size: 16px !important;
151
+ }
152
+ .ttt-stats p {
153
+ margin: 0 !important;
154
+ color: #9ca3af !important;
155
+ }
156
  """
157
 
158
  with gr.Blocks(title="SPIRAL: Interactive Reasoning Game Simulator", theme=gr.themes.Soft(), css=css) as demo:
 
278
  tictactoe_env.reset()
279
 
280
  # Simplified layout focusing only on TicTacToe
281
+ with gr.Row():
282
+ gr.Markdown("### Play TicTacToe against AI")
283
+ gr.Markdown("") # spacer
284
+ ttt_reset_btn = gr.Button("πŸ”„ New Game", variant="secondary", size="sm")
285
+
286
+ gr.Markdown("You are ❌ (X) and go first. Click on a square to make your move.")
287
 
288
+ # Game board centered
289
  with gr.Column(elem_classes=["ttt-board"]):
290
  board_buttons = []
291
  for i in range(3):
 
295
  button = gr.Button("", elem_id=f"ttt-cell-{pos}", size="lg", value="")
296
  board_buttons.append(button)
297
 
298
+ # Stats display centered below board
299
+ with gr.Row():
300
+ ttt_stats_display = gr.Markdown(value="**Wins: 0 | Losses: 0 | Draws: 0**", elem_classes=["ttt-stats"])
301
 
302
  ttt_message = gr.Textbox(
303
  label="Game Status",