haive.games.battleship.config¶
Battleship game agent configuration.
This module defines comprehensive configuration classes for Battleship game agents, providing extensive customization options for game rules, AI behavior, UI preferences, and performance settings.
- The configuration system supports:
Board size and ship placement customization
Multiple difficulty levels and AI strategies
Turn time limits and timeout handling
Analysis and logging capabilities
UI themes and display preferences
Performance optimization settings
- Classes:
BattleshipAgentConfig: Main configuration class for Battleship agents ShipConfiguration: Configuration for ship types and placement rules GameRuleConfiguration: Game rule and validation settings UIConfiguration: User interface and display settings PerformanceConfiguration: Performance and optimization settings
Example
Creating a basic Battleship agent configuration:
- config = BattleshipAgentConfig(
player_name=âAdmiral Hayesâ, difficulty=âintermediateâ, board_size=10, enable_analysis=True, turn_timeout=30.0,
)
agent = BattleshipAgent(config)
Note
All configuration classes include comprehensive validation to ensure game rule consistency and prevent invalid combinations that would break gameplay mechanics.
Classes¶
Comprehensive configuration for Battleship game agents with extensive. |
Module Contents¶
- class haive.games.battleship.config.BattleshipAgentConfig[source]¶
Bases:
haive.core.engine.agent.agent.AgentConfig
Comprehensive configuration for Battleship game agents with extensive. customization.
This configuration class provides complete control over Battleship game mechanics, supporting various game modes, strategic analysis settings, visualization options, and LLM engine configurations. It includes validation for game consistency and provides factory methods for common Battleship scenarios.
The configuration system supports: - Player identification and naming - Strategic analysis and decision-making options - Visualization and debugging settings - LLM engine configurations for different game actions - Performance optimization parameters - Game state management and persistence
- name¶
Unique identifier for the agent instance. Used for logging, debugging, and multi-agent coordination.
- Type:
- state_schema¶
Pydantic model class for game state management. Defines the structure and validation rules for game state.
- Type:
- player1_name¶
Display name for the first player. Used in visualization and game logging. Auto-generated from engine config.
- Type:
- player2_name¶
Display name for the second player. Used in visualization and game logging. Auto-generated from engine config.
- Type:
- enable_analysis¶
Enable strategic analysis during gameplay. When True, agents will perform detailed position analysis before moves.
- Type:
- visualize_board¶
Enable board visualization during gameplay. When True, displays game boards and move history in console.
- Type:
- runnable_config¶
LangChain runnable configuration. Controls execution parameters including recursion limits and thread IDs.
- Type:
RunnableConfig
- engines¶
LLM engine configurations for game actions. Contains engines for ship placement, move generation, and analysis.
- Type:
Dict[str, AugLLMConfig]
Examples
Standard competitive configuration::n
- config = BattleshipAgentConfig(
name=âtournament_battleshipâ, player1_name=âStrategic_AIâ, player2_name=âTactical_AIâ, enable_analysis=True, visualize_board=False
)
Training and debugging configuration::n
- config = BattleshipAgentConfig(
name=âtraining_battleshipâ, enable_analysis=True, visualize_board=True, player1_name=âLearning_Agentâ, player2_name=âReference_Agentâ
)
Performance-optimized configuration::n
- config = BattleshipAgentConfig(
name=âspeed_battleshipâ, enable_analysis=False, visualize_board=False, runnable_config={
- âconfigurableâ: {
ârecursion_limitâ: 5000, âthread_idâ: âspeed_sessionâ
}
}
)
Note
Configuration validation ensures game rule consistency and prevents invalid combinations that would break gameplay mechanics or create unfair advantages.
- classmethod competitive()[source]¶
Create a configuration optimized for competitive gameplay.
Generates a configuration suitable for tournaments and competitive matches, with analysis enabled but visualization disabled for performance.
- Returns:
Configuration optimized for competitive play.
- Return type:
Examples
Creating a tournament-ready configuration::n
config = BattleshipAgentConfig.competitive() agent = BattleshipAgent(config)
# Results in: # - Analysis enabled for strategic depth # - Visualization disabled for performance # - Optimized recursion limits # - Tournament-appropriate naming
- classmethod performance()[source]¶
Create a configuration optimized for maximum performance.
Generates a configuration suitable for high-speed gameplay and benchmarking, with analysis and visualization disabled for optimal performance.
- Returns:
Configuration optimized for performance.
- Return type:
Examples
Creating a performance-optimized configuration::n
config = BattleshipAgentConfig.performance() agent = BattleshipAgent(config)
# Results in: # - Analysis disabled for speed # - Visualization disabled for performance # - Reduced recursion limits # - Performance-appropriate naming
- classmethod training()[source]¶
Create a configuration optimized for training and development.
Generates a configuration suitable for agent training, debugging, and development work, with full analysis and visualization enabled.
- Returns:
Configuration optimized for training scenarios.
- Return type:
Examples
Creating a training configuration::n
config = BattleshipAgentConfig.training() agent = BattleshipAgent(config)
# Results in: # - Analysis enabled for learning # - Visualization enabled for monitoring # - Extended recursion limits # - Training-appropriate naming
- update_player_names_from_engines()[source]¶
Update player names based on LLM provider and model from engines.
Automatically generates meaningful player names based on the configured LLM engines, creating identifiers that include provider and model information. Also ensures thread_id is set for proper session management.
- Returns:
Self with updated player names and thread configuration.
- Return type:
Examples
Configuration with OpenAI engines::n
config = BattleshipAgentConfig() # After validation, player names might be: # player1_name = âazure-gpt-4oâ # player2_name = âPlayer 2â
- property configuration_summary: dict[str, str]¶
Get a summary of the current configuration settings.
Examples
Checking configuration summary::n
config = BattleshipAgentConfig.competitive() summary = config.configuration_summary print(fâMode: {summary[âmodeâ]}â) print(fâAnalysis: {summary[âanalysis_enabledâ]}â)