games.tic_tac_toe.config¶

Comprehensive configuration system for strategic Tic Tac Toe gameplay.

This module provides sophisticated configuration management for Tic Tac Toe agents, supporting various gameplay modes, AI difficulty levels, and analysis features. The configuration system enables flexible game setups from educational tutorials to competitive AI matches with perfect play algorithms.

The configuration system supports: - Multiple AI engine configurations for different skill levels - Strategic analysis toggle for educational gameplay - Visualization options for interactive experiences - Player assignment and turn order customization - Integration with LLM-based decision engines - Tournament-ready configuration presets

Examples

Basic game configuration:

config = TicTacToeConfig(
    name="educational_game",
    enable_analysis=True,
    visualize=True
)

Tournament configuration:

config = TicTacToeConfig(
    name="tournament_match",
    enable_analysis=False,
    visualize=False,
    first_player="X"
)

Custom player setup:

config = TicTacToeConfig(
    player_X="player2",
    player_O="player1",
    first_player="O"
)

Using default configuration:

config = TicTacToeConfig.default_config()
# Ready for standard gameplay

Note

All configurations use Pydantic for validation and support both JSON serialization and integration with the game agent framework.

Classes¶

TicTacToeConfig

Advanced configuration system for Tic Tac Toe game agents.

Module Contents¶

class games.tic_tac_toe.config.TicTacToeConfig¶

Bases: haive.games.framework.base.config.GameConfig

Advanced configuration system for Tic Tac Toe game agents.

This class provides comprehensive configuration management for Tic Tac Toe gameplay, supporting multiple AI personalities, strategic analysis features, and flexible game setups. The configuration enables various gameplay modes from casual games to perfect-play AI competitions.

The configuration supports: - AI engine selection for different skill levels - Strategic analysis for educational purposes - Board visualization for interactive gameplay - Flexible player assignment and turn order - Integration with LLM-based decision systems - Tournament and casual play modes

name¶

Unique identifier for the game configuration. Used for logging and game session management.

Type:

str

state_schema¶

State management class. Defines the game state structure and validation rules.

Type:

Type[TicTacToeState]

engines¶

AI engine configurations. Maps engine roles to their LLM configurations.

Type:

Dict[str, AugLLMConfig]

enable_analysis¶

Toggle for strategic analysis features. When True, provides detailed move explanations.

Type:

bool

visualize¶

Toggle for board visualization. When True, displays board state after each move.

Type:

bool

first_player¶

Starting player symbol. Determines which player makes the first move.

Type:

Literal[‘X’, ‘O’]

player_X¶

Player using X. Maps X symbol to player identifier.

Type:

Literal[‘player1’, ‘player2’]

player_O¶

Player using O. Maps O symbol to player identifier.

Type:

Literal[‘player1’, ‘player2’]

Examples

Educational game with analysis:

config = TicTacToeConfig(
    name="learning_game",
    enable_analysis=True,
    visualize=True,
    first_player="X"
)
# Provides move explanations and board visualization

Competitive AI match:

config = TicTacToeConfig(
    name="ai_competition",
    enable_analysis=False,
    visualize=False,
    engines=advanced_engines
)
# Fast gameplay without analysis overhead

Custom player assignment:

config = TicTacToeConfig(
    player_X="player2",
    player_O="player1",
    first_player="O"
)
# Player 2 uses X, Player 1 uses O and goes first

Tournament configuration:

config = TicTacToeConfig(
    name="tournament_round_1",
    enable_analysis=False,
    visualize=True,
    engines=tournament_engines
)
# Optimized for competitive play with spectator view

Note

The configuration integrates with the game agent framework and supports runtime modification through the agent’s lifecycle.

classmethod competitive_config()¶

Create configuration for competitive AI play.

Features: - No analysis overhead - No visualization delays - Optimized for speed - Perfect for AI tournaments

Returns:

Competitive configuration.

Return type:

TicTacToeConfig

classmethod default_config()¶

Create a default configuration for standard Tic Tac Toe gameplay.

The default configuration is optimized for educational gameplay with both analysis and visualization enabled, suitable for learning and casual play.

Returns:

Default game configuration instance.

Return type:

TicTacToeConfig

Examples

Creating default game:

config = TicTacToeConfig.default_config()
assert config.enable_analysis == True
assert config.visualize == True
assert config.first_player == "X"

Using with agent:

config = TicTacToeConfig.default_config()
agent = TicTacToeAgent(config)
agent.run_game()
classmethod educational_config()¶

Create configuration optimized for learning.

Features: - Full analysis of every position - Board visualization after each move - Detailed move explanations - Perfect for teaching optimal strategy

Returns:

Educational configuration.

Return type:

TicTacToeConfig

classmethod spectator_config()¶

Create configuration for watching games.

Features: - Board visualization enabled - Analysis disabled for speed - Good balance for spectating - Suitable for demonstrations

Returns:

Spectator configuration.

Return type:

TicTacToeConfig

classmethod validate_first_player(v)¶

Validate first player is either X or O.

Parameters:

v (str) – First player symbol to validate.

Returns:

Validated first player symbol.

Return type:

str

Raises:

ValueError – If first player is not X or O.

property game_mode: str¶

Determine the game mode based on configuration.

Returns:

Game mode classification.

Return type:

str

property performance_profile: dict[str, Any]¶

Generate performance profile based on settings.

Returns:

Performance characteristics.

Return type:

Dict[str, Any]