PyCatan-AI / .github /instructions /AI_ARCHITECTURE.md
grubnykeztime-svg
updated INSTRUCTION
afd3d15
# πŸ€– AI Agent Architecture
**Date:** December 23, 2025
**Status:** πŸ“‹ In Planning
## 🎯 Goal
Build an LLM-based AI agent that can play Settlers of Catan autonomously and intelligently.
## πŸ—οΈ Overall Architecture
```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ GameManager β”‚
β”‚ (Game coordination & decisions) β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β€’ game_loop() - Main game loop β”‚
β”‚ β€’ handle_turn_rules() - Turn management β”‚
β”‚ β€’ coordinate_interactions() - Player coordination β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚ β”‚
β–Ό β–Ό β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Game β”‚ β”‚ Users β”‚ β”‚ Viz β”‚
β”‚ (Core) β”‚ β”‚(Players)β”‚ β”‚(Display)β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚
β–Ό β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Human β”‚ β”‚ AI Agent β”‚ ← NEW!
β”‚ User β”‚ β”‚ (LLM) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
βœ… 🚧
```
## πŸ“¦ Existing Components
### 1️⃣ Core - The Game (game.py)
**What exists:**
- Complete and tested game rules
- Board, player, and resource management
- Action validation
**Status:** βœ… Ready and stable
### 2️⃣ GameManager - Game Manager (management/game_manager.py)
**What exists:**
- Turn and phase management
- Player coordination
- Rule enforcement
**Status:** βœ… Ready and stable
### 3️⃣ Actions - Action System (management/actions.py)
**What exists:**
- Definition of all possible game actions
- Unified data structure for each action
- Validation and permissions
**Example:**
```python
class Action:
def __init__(self, action_type, player_num, **kwargs):
self.action_type = action_type # BUILD_SETTLEMENT, BUILD_ROAD, etc.
self.player_num = player_num
self.details = kwargs # point, edge, resources, etc.
```
**Status:** βœ… Ready and stable
### 4️⃣ HumanUser - Human User (players/human_user.py)
**What exists:**
- CLI interaction
- Getting decisions from user
- Executing actions through GameManager
**Status:** βœ… Ready and tested