haive.games.battleship.generic_engines¶

Generic Battleship engine creation using the generic player agent system.

This module provides generic engine creation functions for Battleship games, allowing for configurable LLM models and game-specific player identifiers.

Classes¶

BattleshipEngineFactory

Factory for creating Battleship game engines.

BattleshipPlayerIdentifiers

Player identifiers for Battleship game.

BattleshipPromptGenerator

Prompt generator for Battleship game.

Functions¶

create_budget_battleship_engines(**kwargs)

Create budget-friendly Battleship engines.

create_generic_battleship_config_from_example(example_name)

Create Battleship engines from a predefined example configuration.

create_generic_battleship_engines(player_configs)

Create Battleship engines from detailed player configurations.

create_generic_battleship_engines_simple(...[, ...])

Create Battleship engines with simple model specifications.

create_mixed_battleship_engines(**kwargs)

Create mixed-provider Battleship engines.

create_naval_battleship_engines(**kwargs)

Create naval commander-style Battleship engines with high-powered models.

Module Contents¶

class haive.games.battleship.generic_engines.BattleshipEngineFactory¶

Bases: haive.games.core.agent.generic_player_agent.GenericGameEngineFactory[str, str]

Factory for creating Battleship game engines.

Init .

get_structured_output_model(role)¶

Get the structured output model for a specific role.

Parameters:

role (str)

Return type:

type

class haive.games.battleship.generic_engines.BattleshipPlayerIdentifiers¶

Bases: haive.games.core.agent.generic_player_agent.GamePlayerIdentifiers[str, str]

Player identifiers for Battleship game.

Init .

class haive.games.battleship.generic_engines.BattleshipPromptGenerator(players)¶

Bases: haive.games.core.agent.generic_player_agent.GenericPromptGenerator[str, str]

Prompt generator for Battleship game.

Init .

Parameters:

players (GamePlayerIdentifiers[PlayerType, PlayerType2]) – [TODO: Add description]

create_analyzer_prompt(player)¶

Create analysis prompt for Battleship game state.

Parameters:

player (str)

Return type:

langchain_core.prompts.ChatPromptTemplate

create_move_prompt(player)¶

Create move prompt for Battleship player.

Parameters:

player (str)

Return type:

langchain_core.prompts.ChatPromptTemplate

haive.games.battleship.generic_engines.create_budget_battleship_engines(**kwargs)¶

Create budget-friendly Battleship engines.

Return type:

dict[str, haive.core.engine.aug_llm.AugLLMConfig]

haive.games.battleship.generic_engines.create_generic_battleship_config_from_example(example_name, temperature=0.3)¶

Create Battleship engines from a predefined example configuration.

Parameters:
  • example_name (str) – Name of the example configuration

  • temperature (float) – Generation temperature

Returns:

Dictionary of Battleship engines

Return type:

Dict[str, AugLLMConfig]

Available examples:
  • “gpt_vs_claude”: GPT vs Claude

  • “gpt_only”: GPT for both players

  • “claude_only”: Claude for both players

  • “budget”: Cost-effective models

  • “mixed”: Different provider per role

  • “naval_commanders”: High-powered models for strategic gameplay

haive.games.battleship.generic_engines.create_generic_battleship_engines(player_configs)¶

Create Battleship engines from detailed player configurations.

Parameters:

player_configs (dict[str, haive.games.core.agent.player_agent.PlayerAgentConfig]) – Dictionary mapping role names to player configurations

Returns:

Dictionary of Battleship engines

Return type:

Dict[str, AugLLMConfig]

Expected roles:
  • “player1_player”: Player 1 configuration

  • “player2_player”: Player 2 configuration

  • “player1_analyzer”: Player 1 analyzer configuration

  • “player2_analyzer”: Player 2 analyzer configuration

haive.games.battleship.generic_engines.create_generic_battleship_engines_simple(player1_model, player2_model, temperature=0.3)¶

Create Battleship engines with simple model specifications.

Parameters:
  • player1_model (str) – Model for player 1 and analyzer

  • player2_model (str) – Model for player 2 and analyzer

  • temperature (float) – Generation temperature

Returns:

Dictionary of Battleship engines

Return type:

Dict[str, AugLLMConfig]

haive.games.battleship.generic_engines.create_mixed_battleship_engines(**kwargs)¶

Create mixed-provider Battleship engines.

Return type:

dict[str, haive.core.engine.aug_llm.AugLLMConfig]

haive.games.battleship.generic_engines.create_naval_battleship_engines(**kwargs)¶

Create naval commander-style Battleship engines with high-powered models.

Return type:

dict[str, haive.core.engine.aug_llm.AugLLMConfig]