haive.games.chess.example¶
Example chess game runner.
This module provides an example of how to run a complete chess game using the Haive chess module, demonstrating:
Agent configuration
State initialization
Game streaming
Event monitoring
This is intended as a basic demonstration of the chess module’s capabilities and can be used as a starting point for more complex implementations.
Functions¶
|
Run a complete chess game with LLM players. |
Module Contents¶
- haive.games.chess.example.run_chess_game(thread_id=None)¶
Run a complete chess game with LLM players.
Creates and runs a chess game between two LLM players, streaming the game events and tracking the game status until completion.
- Parameters:
thread_id (str, optional) – Unique identifier for the game thread. If not provided, a random ID will be generated. Defaults to None.
- Returns:
The function outputs game progress to the console.
- Return type:
None
Examples
>>> # Run a game with a random thread ID >>> run_chess_game()
>>> # Run a game with a specific thread ID >>> run_chess_game("chess_custom_id")
Note
This function will run a full chess game with the following configuration: - Both white and black players powered by LLMs - Position analysis enabled - Maximum 200 moves before forcing a draw - Streaming output of game events
The function handles errors gracefully and reports the final game result.