Fixes: ✅ Updated GameEngine._save_play_to_db() to fetch real lineup IDs - Gets active batting/fielding lineups from database - Extracts batter, pitcher, catcher IDs by position - No more hardcoded placeholder IDs ✅ Shortened AbRoll.__str__() to fit VARCHAR(50) - "WP 1/10" instead of "AB Roll: Wild Pitch Check..." - "AB 6,9(4+5) d20=12/10" for normal rolls - Prevents database truncation errors ✅ Created comprehensive test script (scripts/test_game_flow.py) - Tests single at-bat flow - Tests full half-inning (50+ plays) - Creates dummy lineups for both teams - Verifies complete game lifecycle Test Results: ✅ Successfully ran 50 at-bats across 6 innings ✅ Score tracking: Away 5 - Home 2 ✅ Inning advancement working ✅ Play persistence to database ✅ Roll batch saving at inning boundaries ✅ State synchronization (memory + DB) GameEngine Verified Working: ✅ Game lifecycle management (create → start → play → complete) ✅ Decision submission (defensive + offensive) ✅ Play resolution with AbRoll system ✅ State management and persistence ✅ Inning advancement logic ✅ Score tracking ✅ Lineup integration ✅ Database persistence Ready for: - WebSocket integration - Frontend connectivity - Full game simulations - AI opponent integration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| dice.py | ||
| game_engine.py | ||
| play_resolver.py | ||
| roll_types.py | ||
| state_manager.py | ||
| validators.py | ||