haive.games.mancala.state_original ================================== .. py:module:: haive.games.mancala.state_original .. autoapi-nested-parse:: State for the Mancala game. This module defines the state for the Mancala game, which includes the board, turn, game status, move history, free turn, winner, and player analyses. Classes ------- .. autoapisummary:: haive.games.mancala.state_original.MancalaState Module Contents --------------- .. py:class:: MancalaState(/, **data) Bases: :py:obj:`haive.games.framework.base.state.GameState` State for a Mancala game. This class defines the structure of the Mancala game state, which includes the board, turn, game status, move history, free turn, winner, and player analyses. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:method:: copy() Create a deep copy of the current state. :returns: A new instance with the same values :rtype: MancalaState .. py:method:: get_valid_moves(player = None) Get valid moves for the current or specified player. :param player: Player to get moves for ("player1" or "player2"). If None, uses current turn. :returns: List of valid pit indices that can be played :rtype: List[int] .. py:method:: get_winner() Determine the winner of the game. :returns: "player1", "player2", "draw", or None if game ongoing :rtype: Optional[str] .. py:method:: handle_analysis_data(data) :classmethod: Handle conversion of analysis data to proper types. .. py:method:: handle_initialization_data(data) :classmethod: Handle special initialization patterns from the framework. .. py:method:: initialize(stones_per_pit = 4, **kwargs) :classmethod: Initialize a new Mancala game state. :param stones_per_pit: Number of stones to place in each pit initially :param \*\*kwargs: Additional keyword arguments for customization :returns: A new initialized game state :rtype: MancalaState .. py:method:: is_game_over() Check if the game is over. :returns: True if game is over, False otherwise :rtype: bool .. py:method:: model_dump(**kwargs) Override model_dump to ensure proper serialization. .. py:method:: validate_board(v) :classmethod: Validate the board has exactly 14 positions. .. py:property:: board_string :type: str Get a string representation of the board. .. py:property:: player1_score :type: int Get player 1's score (store). .. py:property:: player2_score :type: int Get player 2's score (store).