haive.games.mastermind.ui ========================= .. py:module:: haive.games.mastermind.ui .. autoapi-nested-parse:: Rich UI for the Mastermind game. This module provides a rich terminal UI for the Mastermind game using the Rich library. It displays the game board, guesses, feedback, and analysis in a visually appealing way. Classes ------- .. autoapisummary:: haive.games.mastermind.ui.MastermindUI Module Contents --------------- .. py:class:: MastermindUI(console = None) Rich terminal UI for the Mastermind game. This class provides methods for displaying the Mastermind game state in a visually appealing way using the Rich library. Initialize the UI with a Rich console. :param console: Optional Rich console to use. If not provided, a new one is created. .. py:method:: color_to_styled_text(color) Convert a color name to a styled text object. :param color: The name of the color. :returns: A Rich Text object with appropriate styling for the color. .. py:method:: create_analysis_panel(state) Create a panel with the most recent analysis if available. :param state: The current game state. :returns: A Rich Panel object containing analysis information, or None if no analysis available. .. py:method:: create_guesses_table(state) Create a table displaying all guesses and their feedback. :param state: The current game state. :returns: A Rich Table object containing the guesses and feedback. .. py:method:: create_info_panel(state) Create a panel with game information. :param state: The current game state. :returns: A Rich Panel object containing game information. .. py:method:: create_layout(state) Create a complete layout for the game state. :param state: The current game state. :returns: A Rich Layout object containing all game UI components. .. py:method:: display_final_results(state) Display the final results of the game. :param state: The final game state. .. py:method:: display_game_state(state) Display the current game state. :param state: The current game state. .. py:method:: display_welcome() Display a welcome message for the Mastermind game. .. py:method:: extract_game_state(state_dict) Extract a MastermindState from a state dictionary. :param state_dict: The state dictionary to convert. :returns: A MastermindState object, or None if conversion fails. .. py:method:: print_debug_info(data, label = 'Debug') Print debug information. :param data: The data to print. :param label: A label for the debug panel.