CLAUDE: Fix runner advancement logic for doubles and hit location

Two related bug fixes for gameplay accuracy:

**Backend - play_resolver.py**:
- Fixed DOUBLE2 advancement: Runners now advance exactly 2 bases
  * 1st → 3rd, 2nd → home, 3rd → home
  * Was incorrectly advancing all runners to home

- Fixed DOUBLE3 advancement: Runners now advance exactly 3 bases
  * All runners score (1st+3=4, 2nd+3=5→4, 3rd+3=6→4)
  * Updated docstrings for clarity

**Frontend - ManualOutcomeEntry.vue**:
- Fixed hit location requirement logic
  * Now requires hit location when runners on base (any outs)
  * Was incorrectly restricting to only when outs < 2
  * Hit location determines runner advancement regardless of outs

These fixes ensure accurate Strat-O-Matic gameplay simulation.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2025-11-26 22:21:51 -06:00
parent e90a907e9e
commit dfc7ac99af
2 changed files with 13 additions and 11 deletions

View File

@ -695,22 +695,26 @@ class PlayResolver:
return advances
def _advance_on_double_2(self, state: GameState) -> list[tuple[int, int]]:
"""Calculate runner advancement on double"""
"""Calculate runner advancement on DOUBLE2 - all runners advance exactly 2 bases"""
advances = []
# All runners score on double (simplified)
# Runners advance 2 bases:
# 1st -> 3rd, 2nd -> home, 3rd -> home
for base, _ in state.get_all_runners():
advances.append((base, 4))
final_base = min(base + 2, 4)
advances.append((base, final_base))
return advances
def _advance_on_double_3(self, state: GameState) -> list[tuple[int, int]]:
"""Calculate runner advancement on double"""
"""Calculate runner advancement on DOUBLE3 - all runners advance exactly 3 bases"""
advances = []
# All runners score on double (simplified)
# Runners advance 3 bases (all score from any base)
# 1st -> home (1+3=4), 2nd -> home (2+3=5→4), 3rd -> home
for base, _ in state.get_all_runners():
advances.append((base, 4))
final_base = min(base + 3, 4)
advances.append((base, final_base))
return advances

View File

@ -139,11 +139,9 @@ const needsHitLocation = computed(() => {
if (!selectedOutcome.value) return false
if (!(outcomesNeedingHitLocation as readonly string[]).includes(selectedOutcome.value)) return false
// Hit location only matters when there are runners on base AND less than 2 outs
// (for fielding choices and runner advancement)
const hasRunnersAndCanAdvance = props.hasRunners && props.outs < 2
return hasRunnersAndCanAdvance
// Hit location matters when there are runners on base
// (for determining runner advancement regardless of outs)
return props.hasRunners
})
const canSubmitForm = computed(() => {