haive.games.mancala.state_original¶
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¶
State for a Mancala game. |
Module Contents¶
- class haive.games.mancala.state_original.MancalaState(/, **data)[source]¶
Bases:
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.
- Parameters:
data (Any)
- copy()[source]¶
Create a deep copy of the current state.
- Returns:
A new instance with the same values
- Return type:
- get_winner()[source]¶
Determine the winner of the game.
- Returns:
“player1”, “player2”, “draw”, or None if game ongoing
- Return type:
Optional[str]
- classmethod handle_analysis_data(data)[source]¶
Handle conversion of analysis data to proper types.
- classmethod handle_initialization_data(data)[source]¶
Handle special initialization patterns from the framework.
- classmethod initialize(stones_per_pit=4, **kwargs)[source]¶
Initialize a new Mancala game state.
- Parameters:
stones_per_pit (int) – Number of stones to place in each pit initially
**kwargs – Additional keyword arguments for customization
- Returns:
A new initialized game state
- Return type:
- is_game_over()[source]¶
Check if the game is over.
- Returns:
True if game is over, False otherwise
- Return type: