games.dominoes.ui¶

Rich UI module for Dominoes game visualization.

This module provides rich console UI components for visualizing the Dominoes game.

Classes¶

DominoesUI

Rich UI for Dominoes game visualization.

Module Contents¶

class games.dominoes.ui.DominoesUI(console=None)¶

Rich UI for Dominoes game visualization.

Initialize the UI.

Parameters:

console (rich.console.Console | None) – Optional Rich console instance

create_analysis_panel(game_state)¶

Create a panel showing the latest analysis.

Parameters:

game_state (haive.games.dominoes.state.DominoesState) – Current game state

Returns:

Rich panel with analysis info

Return type:

rich.panel.Panel

create_board_panel(game_state)¶

Create a visual representation of the dominoes board.

Parameters:

game_state (haive.games.dominoes.state.DominoesState) – Current game state

Returns:

Rich panel representing the board

Return type:

rich.panel.Panel

create_game_info_panel(game_state)¶

Create a panel with game information.

Parameters:

game_state (haive.games.dominoes.state.DominoesState) – Current game state

Returns:

Rich panel with game info

Return type:

rich.panel.Panel

create_last_move_panel(game_state)¶

Create a panel showing the last move.

Parameters:

game_state (haive.games.dominoes.state.DominoesState) – Current game state

Returns:

Rich panel with last move info

Return type:

rich.panel.Panel

create_layout(game_state)¶

Create the complete rich UI layout.

Parameters:

game_state (haive.games.dominoes.state.DominoesState) – Current game state

Returns:

Complete rich layout

Return type:

rich.layout.Layout

create_player_hand_panel(game_state, player)¶

Create a panel showing a player’s hand.

Parameters:
Returns:

Rich panel with player’s hand

Return type:

rich.panel.Panel

display_final_results(final_state)¶

Display final game results.

Parameters:

final_state (Any) – Final game state

Return type:

None

display_state(state_data)¶

Display the game state using rich UI.

Parameters:

state_data (Any) – State data in various formats

Returns:

True if display was successful, False otherwise

Return type:

bool

display_welcome()¶

Display welcome message.

Return type:

None

extract_game_state(state_data)¶

Extract DominoesState from various input formats.

Parameters:

state_data (Any) – State data in various formats

Returns:

DominoesState instance or None if extraction fails

Return type:

haive.games.dominoes.state.DominoesState | None

print_debug_info(state_data, context='')¶

Print debug information about the state.

Parameters:
  • state_data (Any) – State data to debug

  • context (str) – Context string for debugging

Return type:

None