diff --git a/commander_ai_lab/ai/__init__.py b/commander_ai_lab/ai/__init__.py new file mode 100644 index 0000000..d39fa34 --- /dev/null +++ b/commander_ai_lab/ai/__init__.py @@ -0,0 +1 @@ +# Phase 2: Dual-Brain AI Decision Engine diff --git a/commander_ai_lab/ai/decision_logger.py b/commander_ai_lab/ai/decision_logger.py new file mode 100644 index 0000000..36cb50a --- /dev/null +++ b/commander_ai_lab/ai/decision_logger.py @@ -0,0 +1,5 @@ +# Phase 6 - decision_logger.py +# Logs per-decision: game_id, turn, phase, player_id, personality, +# brain_used, prompt, raw_response, parsed_action, fallback_used +# Configurable via LOG_AI_DECISIONS env var +# See issue #173 diff --git a/commander_ai_lab/ai/game_orchestrator.py b/commander_ai_lab/ai/game_orchestrator.py new file mode 100644 index 0000000..4f7b008 --- /dev/null +++ b/commander_ai_lab/ai/game_orchestrator.py @@ -0,0 +1,15 @@ +# Phase 2 - game_orchestrator.py *** CORE PRIORITY *** +# GameAIOrchestrator: select_brain(), assign_personalities(), get_action() +# Brains: DeepSeek-R1-14B (complex) + GPT-OSS-20B (tactical) +# ChromaDB RAG for per-player card knowledge +# See issue #169 + +PERSONALITY_POOL = [ + "aggressive -- attack early and often, prioritize players with lowest life totals", + "control -- counter key spells, hold mana open, only act when clearly advantageous", + "combo -- develop mana and card advantage quietly, avoid conflict until ready to win", + "political -- make deals, attack whoever is ahead, never fully commit to one target", + "pillowfort -- build defensive pieces, let others fight, win slowly through attrition", + "stompy -- play the biggest threats as fast as possible, ignore table politics", + "tempo -- disrupt opponents early, trade efficiently, stay ahead on board", +] diff --git a/commander_ai_lab/cards/__init__.py b/commander_ai_lab/cards/__init__.py new file mode 100644 index 0000000..dd90e33 --- /dev/null +++ b/commander_ai_lab/cards/__init__.py @@ -0,0 +1 @@ +# Phase 0: Card image cache and data enrichment diff --git a/commander_ai_lab/cards/card_data_enricher.py b/commander_ai_lab/cards/card_data_enricher.py new file mode 100644 index 0000000..d65aa72 --- /dev/null +++ b/commander_ai_lab/cards/card_data_enricher.py @@ -0,0 +1,3 @@ +# Phase 0 - card_data_enricher.py +# Injects art_url and art_url_back into CardDTO before broadcasting to Unity +# See issue #167 diff --git a/commander_ai_lab/cards/image_cache.py b/commander_ai_lab/cards/image_cache.py new file mode 100644 index 0000000..e02ad0f --- /dev/null +++ b/commander_ai_lab/cards/image_cache.py @@ -0,0 +1,3 @@ +# Phase 0 - image_cache.py +# SQLite-backed lookup: card name/scryfall_id -> local file path +# See issue #167 diff --git a/commander_ai_lab/forge/__init__.py b/commander_ai_lab/forge/__init__.py new file mode 100644 index 0000000..08fc55e --- /dev/null +++ b/commander_ai_lab/forge/__init__.py @@ -0,0 +1 @@ +# Phase 1: Forge subprocess bridge diff --git a/commander_ai_lab/forge/game_result_logger.py b/commander_ai_lab/forge/game_result_logger.py new file mode 100644 index 0000000..068df19 --- /dev/null +++ b/commander_ai_lab/forge/game_result_logger.py @@ -0,0 +1,3 @@ +# Phase 6 - game_result_logger.py +# Captures winner, turn count, elimination order on Forge game end +# See issue #173 diff --git a/commander_ai_lab/forge/game_state_parser.py b/commander_ai_lab/forge/game_state_parser.py new file mode 100644 index 0000000..cbe98c8 --- /dev/null +++ b/commander_ai_lab/forge/game_state_parser.py @@ -0,0 +1,3 @@ +# Phase 1 - game_state_parser.py +# Converts Forge stdout text -> canonical GameStateDTO JSON +# See issue #168 diff --git a/commander_ai_lab/forge/subprocess_manager.py b/commander_ai_lab/forge/subprocess_manager.py new file mode 100644 index 0000000..b4d0d13 --- /dev/null +++ b/commander_ai_lab/forge/subprocess_manager.py @@ -0,0 +1,4 @@ +# Phase 1 - subprocess_manager.py +# ForgeGameSession + ForgeSubprocessManager +# Drives interactive Commander games via Forge stdin/stdout pipe +# See issue #168 diff --git a/commander_ai_lab/training/__init__.py b/commander_ai_lab/training/__init__.py new file mode 100644 index 0000000..6e95a61 --- /dev/null +++ b/commander_ai_lab/training/__init__.py @@ -0,0 +1 @@ +# Phase 6: ML Training Integration diff --git a/commander_ai_lab/training/training_data_builder.py b/commander_ai_lab/training/training_data_builder.py new file mode 100644 index 0000000..2b2e080 --- /dev/null +++ b/commander_ai_lab/training/training_data_builder.py @@ -0,0 +1,4 @@ +# Phase 6 - training_data_builder.py +# Converts decision_log + game_result -> (state, action, reward) tuples +# Feeds existing PPO pipeline +# See issue #173 diff --git a/data/.gitkeep b/data/.gitkeep new file mode 100644 index 0000000..5a0e863 --- /dev/null +++ b/data/.gitkeep @@ -0,0 +1,2 @@ +# Runtime data directory +# card_image_index.db, decision_logs/, game_results.jsonl, training_sets/ diff --git a/scripts/build_image_index.py b/scripts/build_image_index.py new file mode 100644 index 0000000..df41ec3 --- /dev/null +++ b/scripts/build_image_index.py @@ -0,0 +1,3 @@ +# Phase 0 - build_image_index.py +# Builds SQLite card_image_index.db: name/scryfall_id -> file path +# See issue #167 diff --git a/scripts/download_card_images.py b/scripts/download_card_images.py new file mode 100644 index 0000000..b2ce65c --- /dev/null +++ b/scripts/download_card_images.py @@ -0,0 +1,4 @@ +# Phase 0 - download_card_images.py +# Bulk download card images from Scryfall default_cards export +# Stores at static/card-images/{scryfall_id}_{front|back}.jpg +# See issue #167 diff --git a/scripts/run_self_play.py b/scripts/run_self_play.py new file mode 100644 index 0000000..c5796bc --- /dev/null +++ b/scripts/run_self_play.py @@ -0,0 +1,4 @@ +# Phase 6 - run_self_play.py +# Headless self-play runner: all 4 players AI-driven, no Unity needed +# Usage: python scripts/run_self_play.py --num-games 500 --deck-pool-path data/decks/ +# See issue #173 diff --git a/static/card-images/.gitkeep b/static/card-images/.gitkeep new file mode 100644 index 0000000..df661eb --- /dev/null +++ b/static/card-images/.gitkeep @@ -0,0 +1,2 @@ +# Phase 0: Card images downloaded here by scripts/download_card_images.py +# ~1.5-2GB at normal size diff --git a/unity-commander-ui/.gitkeep b/unity-commander-ui/.gitkeep new file mode 100644 index 0000000..b25c1cf --- /dev/null +++ b/unity-commander-ui/.gitkeep @@ -0,0 +1,2 @@ +# Phase 4: Unity TCGEngine project lives here +# See issue #171