games.tic_tac_toe.ui¶

Rich UI Game Runner for Tic Tac Toe.

This module provides a beautiful, interactive UI for running Tic Tac Toe games using the Rich library for enhanced terminal displays.

Classes¶

RichTicTacToeRunner

Rich UI runner for Tic Tac Toe games.

Module Contents¶

class games.tic_tac_toe.ui.RichTicTacToeRunner(agent)¶

Rich UI runner for Tic Tac Toe games.

Initialize the Rich UI runner.

Parameters:

agent (haive.games.tic_tac_toe.agent.TicTacToeAgent) – The TicTacToe agent to run

create_analysis_panel(state)¶

Create a panel showing the latest analysis.

Parameters:

state (haive.games.tic_tac_toe.state.TicTacToeState) – Current game state

Returns:

Rich Panel with analysis info, or None if no analysis

Return type:

rich.panel.Panel | None

create_board_panel(state)¶

Create a rich panel displaying the game board.

Parameters:

state (haive.games.tic_tac_toe.state.TicTacToeState) – Current game state

Returns:

Rich Panel with the game board

Return type:

rich.panel.Panel

create_game_info_panel(state)¶

Create a panel with game information.

Parameters:

state (haive.games.tic_tac_toe.state.TicTacToeState) – Current game state

Returns:

Rich Panel with game info

Return type:

rich.panel.Panel

create_layout(state)¶

Create the main layout for the game display.

Parameters:

state (haive.games.tic_tac_toe.state.TicTacToeState) – Current game state

Returns:

Rich Layout object

Return type:

rich.layout.Layout

run_game(show_thinking=True, step_delay=1.0, debug=False)¶

Run the Tic Tac Toe game with Rich UI.

Parameters:
  • show_thinking (bool) – Whether to show thinking animations

  • step_delay (float) – Delay between moves in seconds

  • debug (bool) – Whether to show debug information

Returns:

Final game state

Return type:

dict[str, Any]

show_game_summary(final_state)¶

Show a summary of the completed game.

Parameters:

final_state (dict[str, Any]) – The final state of the game

show_thinking_animation(player, duration=2.0)¶

Show a thinking animation while AI is processing.

Parameters:
  • player (str) – The player who is thinking

  • duration (float) – How long to show the animation