"""Configuration model for the Reversi (Othello) game agent.Defines game metadata, initial settings, and engine bindings used to drive the game loopand decision-making by language models."""fromtypingimportLiteralfromhaive.core.engine.aug_llmimportAugLLMConfigfrompydanticimportFieldfromhaive.games.framework.base.configimportGameConfigfromhaive.games.reversi.enginesimportreversi_enginesfromhaive.games.reversi.stateimportReversiState
[docs]classReversiConfig(GameConfig):"""Configuration for the Reversi/Othello game agent. Attributes: name (str): Name of the game. state_schema (Type[ReversiState]): The state model used for gameplay. engines (Dict[str, AugLLMConfig]): Mapping of engine names to LLM configurations. enable_analysis (bool): Whether to run post-move analysis. visualize (bool): Whether to render the board visually in the console. first_player (Literal['B', 'W']): Symbol of the player who starts (Black or White). player_B (Literal['player1', 'player2']): Who controls the Black pieces. player_W (Literal['player1', 'player2']): Who controls the White pieces. """name:str=Field(default="reversi",description="Name of the game")state_schema:type[ReversiState]=Field(default=ReversiState,description="State schema for Reversi")engines:dict[str,AugLLMConfig]=Field(default=reversi_engines,description="Configs for the Reversi engines")enable_analysis:bool=Field(default=True,description="Whether to enable position analysis")visualize:bool=Field(default=True,description="Whether to visualize the game")first_player:Literal["B","W"]=Field(default="B",description="Which symbol goes first (Black is traditional)")player_B:Literal["player1","player2"]=Field(default="player1",description="Which player uses Black")player_W:Literal["player1","player2"]=Field(default="player2",description="Which player uses White")
[docs]@classmethoddefdefault_config(cls):"""Create a default configuration for Reversi. Returns: ReversiConfig: An instance with standard engine bindings and player layout. """returncls(name="reversi",state_schema=ReversiState,engines=reversi_engines,enable_analysis=True,visualize=True,first_player="B",player_B="player1",player_W="player2",)