haive.games.clue.ui =================== .. py:module:: haive.games.clue.ui .. autoapi-nested-parse:: Clue rich UI visualization module. This module provides a visually appealing terminal UI for Clue games, with styled components, animations, and comprehensive game information. It uses the Rich library to create a console-based UI with: - Game board visualization with players, suspects, weapons, and rooms - Guess history with detailed responses - Player cards and deduction notes - Game status and information - Thinking animations and guess visualization .. rubric:: Example >>> from haive.games.clue.ui import ClueUI >>> from haive.games.clue.state import ClueState >>> >>> ui = ClueUI() >>> state = ClueState.initialize() >>> ui.display_state(state) # Display the initial game state >>> >>> # Show thinking animation for player >>> ui.show_thinking("player1") >>> >>> # Display a guess >>> from haive.games.clue.models import ClueGuess, ValidSuspect, ValidWeapon, ValidRoom >>> guess = ClueGuess( >>> suspect=ValidSuspect.COLONEL_MUSTARD, >>> weapon=ValidWeapon.KNIFE, >>> room=ValidRoom.KITCHEN >>> ) >>> ui.show_guess(guess, "player1") Classes ------- .. autoapisummary:: haive.games.clue.ui.ClueUI Module Contents --------------- .. py:class:: ClueUI Rich UI for beautiful Clue game visualization. This class provides a visually appealing terminal UI for Clue games, with styled components, animations, and comprehensive game information. Features: - Game board visualization with suspects, weapons, and rooms - Guess history with detailed responses - Player cards and deduction notes - Game status and information - Thinking animations and guess visualization .. attribute:: console Rich console for output :type: Console .. attribute:: layout Layout manager for UI components :type: Layout .. attribute:: colors Color schemes for different UI elements :type: dict .. rubric:: Examples >>> ui = ClueUI() >>> state = ClueState.initialize() >>> ui.display_state(state) # Display the initial game state Initialize the Clue UI with default settings. .. py:method:: display_state(state) Display the current game state with rich formatting. Renders the complete game state including suspects, weapons, rooms, guess history, player cards, and game information in a formatted layout. :param state: Current game state :type state: Union[ClueState, Dict[str, Any]] :returns: None .. rubric:: Example >>> ui = ClueUI() >>> state = ClueState.initialize() >>> ui.display_state(state) .. py:method:: show_game_over(state) Display game over message with result. Shows a game over panel with the winner highlighted in their color, and reveals the solution. :param state: Final game state :type state: ClueState :returns: None .. rubric:: Example >>> ui = ClueUI() >>> state = ClueState.initialize() >>> state.game_status = "player1_win" >>> state.winner = "player1" >>> ui.show_game_over(state) .. py:method:: show_guess(guess, player) Display a guess being made. Shows a formatted message indicating which player made a guess, including the suspect, weapon, and room. :param guess: The guess being made :type guess: ClueGuess :param player: Player making the guess ("player1" or "player2") :type player: str :returns: None .. rubric:: Example >>> ui = ClueUI() >>> guess = ClueGuess( ... suspect=ValidSuspect.COLONEL_MUSTARD, ... weapon=ValidWeapon.KNIFE, ... room=ValidRoom.KITCHEN ... ) >>> ui.show_guess(guess, "player1") .. py:method:: show_response(response, player) Display a response to a guess. Shows a formatted message indicating the response to a guess, including which player responded and what card was shown. :param response: The response to the guess :type response: ClueResponse :param player: Player who made the guess ("player1" or "player2") :type player: str :returns: None .. rubric:: Example >>> ui = ClueUI() >>> response = ClueResponse( ... is_correct=False, ... responding_player="player2", ... refuting_card=ClueCard(name="Knife", card_type=CardType.WEAPON) ... ) >>> ui.show_response(response, "player1") .. py:method:: show_thinking(player, message = 'Thinking...') Display a thinking animation for the current player. Shows a spinner animation with player-colored text to indicate that the player is thinking about their guess. :param player: Current player ("player1" or "player2") :type player: str :param message: Custom message to display. Defaults to "Thinking...". :type message: str, optional :returns: None .. rubric:: Example >>> ui = ClueUI() >>> ui.show_thinking("player1", "Analyzing clues...")