games.reversi.state¶
Reversi (Othello) game state model.
Defines board layout, current game status, turn tracking, move history, analysis storage, and rendering utilities for the Reversi agent system.
Classes¶
State model for a game of Reversi/Othello. |
Module Contents¶
- class games.reversi.state.ReversiState(/, **data)¶
Bases:
haive.games.framework.base.state.GameState
State model for a game of Reversi/Othello.
- Parameters:
data (Any)
- move_history¶
History of all moves made.
- Type:
List[ReversiMove]
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.
- classmethod initialize(first_player='B', player_B='player1', player_W='player2')¶
Class-level initializer for ReversiState.
- Parameters:
- Returns:
Initialized state.
- Return type:
- classmethod validate_board(board)¶
Validate that the board is an 8x8 grid with only valid values.
- Parameters:
board (List[List[Optional[str]]]) – Input board state.
- Returns:
The validated board.
- Return type:
List[List[Optional[str]]]
- Raises:
ValueError – If the board structure or contents are invalid.
- property board_string: str¶
Get a human-readable string of the current board layout.
- Returns:
Formatted board as text.
- Return type: