haive.games.nim.ui ================== .. py:module:: haive.games.nim.ui .. autoapi-nested-parse:: Rich UI implementation for the Nim game. This module provides a Rich-based UI for visualizing and interacting with the Nim game. It includes a NimUI class that handles visualization of the game state, piles, and game information. Classes ------- .. autoapisummary:: haive.games.nim.ui.NimUI Module Contents --------------- .. py:class:: NimUI Rich terminal UI for the Nim game. This class provides methods for visualizing the Nim game state using the Rich library. It includes methods for displaying the game board, piles, game information, and analysis. Initialize the UI with a Rich console if available. .. py:method:: create_analysis_panel(state) Create a panel showing the latest analysis if available. :param state: The current game state. :returns: A Rich panel containing analysis information, or None if no analysis. :rtype: Optional[Panel] .. py:method:: create_header(state) Create header panel with game info. :param state: The current game state. :returns: A Rich panel containing the game header information. :rtype: Panel .. py:method:: create_layout(state) Create the complete layout for the game display. :param state: The current game state. :returns: A Rich layout for the complete game display. :rtype: Layout .. py:method:: create_moves_table(state) Create a table showing move history. :param state: The current game state. :returns: A Rich table containing the move history. :rtype: Table .. py:method:: create_piles_panel(state) Create a panel showing the piles of stones. :param state: The current game state. :returns: A Rich panel containing visualizations of the piles. :rtype: Panel .. py:method:: display_game_state(state) Display the current game state using Rich UI or fallback text UI. :param state: The current game state as a NimState object or dict. .. py:method:: prompt_for_move(state) Prompt the user to input a move. :param state: The current game state. :returns: The move chosen by the user. :rtype: NimMove