9627a79dce
3 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
263e1536a9
|
CLAUDE: Add interrupt plays, jump roll, and fielding roll testing commands to terminal client
Implemented features: - Interrupt play commands: * force_wild_pitch - Force wild pitch interrupt (advances runners 1 base) * force_passed_ball - Force passed ball interrupt (advances runners 1 base) - Jump roll testing commands: * roll_jump [league] - Roll jump dice for steal testing (1d20 + 2d6/1d20) * test_jump [count] [league] - Test jump roll distribution with statistics - Fielding roll testing commands: * roll_fielding <position> [league] - Roll fielding dice (1d20 + 3d6 + 1d100) * test_fielding <position> [count] [league] - Test fielding roll distribution All commands include: - Rich terminal formatting with colored output - Comprehensive help text and examples - TAB completion for all arguments - Input validation - Statistical analysis for test commands Jump rolls show: - Pickoff attempts (5% chance, check_roll=1) - Balk checks (5% chance, check_roll=2) - Normal jump (90%, 2d6 for steal success) Fielding rolls show: - Range check (1d20) - Error total (3d6, range 3-18) - Rare play detection (SBA: d100=1, PD: error_total=5) Testing commands provide: - Distribution tables with percentages - Visual bar charts - Expected vs observed statistics - Average calculations Files modified: - terminal_client/commands.py: Added 6 new command methods - terminal_client/repl.py: Added 6 new REPL commands with help - terminal_client/completions.py: Added TAB completion support |
||
|
|
d7caa75310 |
CLAUDE: Add manual outcome testing to terminal client and Phase 3 planning
Terminal Client Enhancements: - Added list_outcomes command to display all PlayOutcome values - Added resolve_with <outcome> command for testing specific scenarios - TAB completion for all outcome names - Full help documentation and examples - Infrastructure ready for Week 7 integration Files Modified: - terminal_client/commands.py - list_outcomes() and forced outcome support - terminal_client/repl.py - do_list_outcomes() and do_resolve_with() commands - terminal_client/completions.py - VALID_OUTCOMES and complete_resolve_with() - terminal_client/help_text.py - Help entries for new commands Phase 3 Planning: - Created comprehensive Week 7 implementation plan (25 pages) - 6 major tasks covering strategic decisions and result charts - Updated 00-index.md to mark Week 6 as 100% complete - Documented manual outcome testing feature Week 6: 100% Complete ✅ Phase 3 Week 7: Ready to begin 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
1c32787195 |
CLAUDE: Refactor game models and modularize terminal client
This commit includes cleanup from model refactoring and terminal client
modularization for better code organization and maintainability.
## Game Models Refactor
**Removed RunnerState class:**
- Eliminated separate RunnerState model (was redundant)
- Replaced runners: List[RunnerState] with direct base references:
- on_first: Optional[LineupPlayerState]
- on_second: Optional[LineupPlayerState]
- on_third: Optional[LineupPlayerState]
- Updated helper methods:
- get_runner_at_base() now returns LineupPlayerState directly
- get_all_runners() returns List[Tuple[int, LineupPlayerState]]
- is_runner_on_X() simplified to direct None checks
**Benefits:**
- Matches database structure (plays table has on_first_id, etc.)
- Simpler state management (direct references vs list management)
- Better type safety (LineupPlayerState vs generic runner)
- Easier to work with in game engine logic
**Updated files:**
- app/models/game_models.py - Removed RunnerState, updated GameState
- app/core/play_resolver.py - Use get_all_runners() instead of state.runners
- app/core/validators.py - Updated runner access patterns
- tests/unit/models/test_game_models.py - Updated test assertions
- tests/unit/core/test_play_resolver.py - Updated test data
- tests/unit/core/test_validators.py - Updated test data
## Terminal Client Refactor
**Modularization (DRY principle):**
Created separate modules for better code organization:
1. **terminal_client/commands.py** (10,243 bytes)
- Shared command functions for game operations
- Used by both CLI (main.py) and REPL (repl.py)
- Functions: submit_defensive_decision, submit_offensive_decision,
resolve_play, quick_play_sequence
- Single source of truth for command logic
2. **terminal_client/arg_parser.py** (7,280 bytes)
- Centralized argument parsing and validation
- Handles defensive/offensive decision arguments
- Validates formats (alignment, depths, hold runners, steal attempts)
3. **terminal_client/completions.py** (10,357 bytes)
- TAB completion support for REPL mode
- Command completions, option completions, dynamic completions
- Game ID completions, defensive/offensive option suggestions
4. **terminal_client/help_text.py** (10,839 bytes)
- Centralized help text and command documentation
- Detailed command descriptions
- Usage examples for all commands
**Updated main modules:**
- terminal_client/main.py - Simplified by using shared commands module
- terminal_client/repl.py - Cleaner with shared functions and completions
**Benefits:**
- DRY: Behavior consistent between CLI and REPL modes
- Maintainability: Changes in one place affect both interfaces
- Testability: Can test commands module independently
- Organization: Clear separation of concerns
## Documentation
**New files:**
- app/models/visual_model_relationships.md
- Visual documentation of model relationships
- Helps understand data flow between models
- terminal_client/update_docs/ (6 phase documentation files)
- Phased documentation for terminal client evolution
- Historical context for implementation decisions
## Tests
**New test files:**
- tests/unit/terminal_client/__init__.py
- tests/unit/terminal_client/test_arg_parser.py
- tests/unit/terminal_client/test_commands.py
- tests/unit/terminal_client/test_completions.py
- tests/unit/terminal_client/test_help_text.py
**Updated tests:**
- Integration tests updated for new runner model
- Unit tests updated for model changes
- All tests passing with new structure
## Summary
- ✅ Simplified game state model (removed RunnerState)
- ✅ Better alignment with database structure
- ✅ Modularized terminal client (DRY principle)
- ✅ Shared command logic between CLI and REPL
- ✅ Comprehensive test coverage
- ✅ Improved documentation
Total changes: 26 files modified/created
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|