haive.games.nim.agent¶
Agent for playing Nim.
This module defines the Nim agent, which uses language models to generate moves and analyze positions in the game.
Classes¶
Agent for playing Nim. |
Functions¶
|
Ensure input is converted to NimState. |
Module Contents¶
- class haive.games.nim.agent.NimAgent(config=NimConfig())[source]¶
Bases:
haive.games.framework.base.agent.GameAgent
[haive.games.nim.config.NimConfig
]Agent for playing Nim.
Initialize the Nim agent.
- Parameters:
config (NimConfig) – The configuration for the game.
- analyze_player1(state)[source]¶
Analyze position for player1.
- Parameters:
state (NimState) – The current game state.
- Returns:
The command to analyze the position.
- Return type:
Command
- analyze_player2(state)[source]¶
Analyze position for player2.
- Parameters:
state (NimState) – The current game state.
- Returns:
The command to analyze the position.
- Return type:
Command
- extract_move(response)[source]¶
Extract move from engine response.
- Parameters:
response (Any) – The response from the engine.
- Returns:
The move from the engine.
- Return type:
Any
- make_player1_move(state)[source]¶
Make a move for player1.
- Parameters:
state (NimState) – The current game state.
- Returns:
The command to make the move.
- Return type:
Command
- make_player2_move(state)[source]¶
Make a move for player2.
- Parameters:
state (NimState) – The current game state.
- Returns:
The command to make the move.
- Return type:
Command