strat-gameplay-webapp/backend
Cal Corum 95d8703f56 CLAUDE: Implement Week 7 Task 1 - Strategic Decision Integration
Enhanced game engine with async decision workflow and AI opponent integration:

GameState Model Enhancements:
- Added pending_defensive_decision and pending_offensive_decision fields
- Added decision_phase tracking (idle, awaiting_defensive, awaiting_offensive, resolving, completed)
- Added decision_deadline field for timeout handling
- Added is_batting_team_ai() and is_fielding_team_ai() helper methods
- Added validator for decision_phase

StateManager Enhancements:
- Added _pending_decisions dict for asyncio.Future-based decision queue
- Added set_pending_decision() to create decision futures
- Added await_decision() to wait for decision submission
- Added submit_decision() to resolve pending futures
- Added cancel_pending_decision() for cleanup

GameEngine Enhancements:
- Added await_defensive_decision() with AI/human branching and timeout
- Added await_offensive_decision() with AI/human branching and timeout
- Enhanced submit_defensive_decision() to resolve pending futures
- Enhanced submit_offensive_decision() to resolve pending futures
- Added DECISION_TIMEOUT constant (30 seconds)

AI Opponent (Stub):
- Created ai_opponent.py with stub implementations
- generate_defensive_decision() returns default "normal" positioning
- generate_offensive_decision() returns default "normal" approach
- TODO markers for Week 9 full AI logic implementation

Integration:
- Backward compatible with existing terminal client workflow
- New async methods ready for WebSocket integration (Week 7 Task 4)
- AI teams get instant decisions, human teams wait with timeout
- Default decisions applied on timeout (no game blocking)

Testing:
- Config tests: 58/58 passing 
- Terminal client: Working perfectly 
- Existing workflows: Fully compatible 

Week 7 Task 1: Complete
Next: Task 2 - Decision Validators

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 21:38:11 -05:00
..
.claude CLAUDE: Refactor GameEngine to forward-looking play tracking pattern 2025-10-25 22:18:15 -05:00
app CLAUDE: Implement Week 7 Task 1 - Strategic Decision Integration 2025-10-29 21:38:11 -05:00
scripts CLAUDE: Refactor GameEngine to forward-looking play tracking pattern 2025-10-25 22:18:15 -05:00
terminal_client CLAUDE: Add manual outcome testing to terminal client and Phase 3 planning 2025-10-29 20:53:47 -05:00
tests CLAUDE: Complete Week 6 - granular PlayOutcome integration and metadata support 2025-10-29 20:29:06 -05:00
.dockerignore CLAUDE: Initial project setup - documentation and infrastructure 2025-10-21 16:21:13 -05:00
.env.example CLAUDE: Complete Phase 1 backend infrastructure setup 2025-10-21 19:46:16 -05:00
CLAUDE.md CLAUDE: Implement Week 6 league configuration and play outcome systems 2025-10-28 22:46:12 -05:00
clean_test_data.py CLAUDE: Refactor game models and modularize terminal client 2025-10-28 14:16:38 -05:00
docker-compose.yml CLAUDE: Complete Phase 1 backend infrastructure setup 2025-10-21 19:46:16 -05:00
Dockerfile CLAUDE: Initial project setup - documentation and infrastructure 2025-10-21 16:21:13 -05:00
mypy.ini CLAUDE: Refactor GameEngine to forward-looking play tracking pattern 2025-10-25 22:18:15 -05:00
pyrightconfig.json Clean up false positive Pylance errors 2025-10-23 09:10:41 -05:00
pytest.ini CLAUDE: Complete Week 4 - State Management & Persistence 2025-10-22 12:01:03 -05:00
requirements-dev.txt CLAUDE: Complete Phase 1 backend infrastructure setup 2025-10-21 19:46:16 -05:00
requirements.txt CLAUDE: Add interactive terminal client for game engine testing 2025-10-26 12:51:01 -05:00
test_db_playground.py Add scripts to test models in dev database 2025-10-23 09:10:55 -05:00