"""
Machine learning utilities for Catan:
- Agents (random, policy-based)
- Observation/action encoders
- Trainers for reinforcement learning and evolutionary strategies
"""

from .agents import Agent, PolicyAgent, RandomAgent, finalize_action
from .encoding import encode_action, encode_observation

__all__ = [
    "Agent",
    "PolicyAgent",
    "RandomAgent",
    "encode_action",
    "encode_observation",
    "finalize_action",
]

try:
    from .trainers import EvolutionStrategyTrainer, ReinforcementLearningTrainer
    from .selfplay import PPOConfig, SelfPlayPPOTrainer
except ModuleNotFoundError as exc:
    if exc.name != "torch":
        raise
    EvolutionStrategyTrainer = None
    ReinforcementLearningTrainer = None
    PPOConfig = None
    SelfPlayPPOTrainer = None
else:
    __all__ += [
        "ReinforcementLearningTrainer",
        "EvolutionStrategyTrainer",
        "SelfPlayPPOTrainer",
        "PPOConfig",
    ]
