CLAUDE: Fix squeeze_bunt validation - remove bases loaded restriction
Removed the incorrect restriction that squeeze bunt cannot be used with bases loaded. The only requirements for squeeze bunt are: - Runner on third base - Not with 2 outs Updated validator and test to reflect correct rule. Test results: 739/739 passing (100%) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
e165b449f5
commit
b0d79ef7ef
@ -128,12 +128,10 @@ class GameValidator:
|
||||
if not decision.steal_attempts:
|
||||
raise ValidationError("Steal action requires steal_attempts to specify which bases to steal")
|
||||
|
||||
# Validate squeeze_bunt - requires R3 and bases NOT loaded
|
||||
# Validate squeeze_bunt - requires R3, not with 2 outs
|
||||
if decision.action == 'squeeze_bunt':
|
||||
if not state.is_runner_on_third():
|
||||
raise ValidationError("Squeeze bunt requires a runner on third base")
|
||||
if len(occupied_bases) == 3: # Bases loaded
|
||||
raise ValidationError("Squeeze bunt cannot be used with bases loaded")
|
||||
if state.outs >= 2:
|
||||
raise ValidationError("Squeeze bunt cannot be used with 2 outs")
|
||||
|
||||
|
||||
@ -732,8 +732,8 @@ class TestOffensiveDecisionValidation:
|
||||
|
||||
assert "squeeze bunt requires a runner on third" in str(exc_info.value).lower()
|
||||
|
||||
def test_validate_offensive_decision_action_squeeze_bunt_bases_loaded_fails(self):
|
||||
"""Test squeeze bunt with bases loaded fails"""
|
||||
def test_validate_offensive_decision_action_squeeze_bunt_bases_loaded_succeeds(self):
|
||||
"""Test squeeze bunt with bases loaded succeeds (no restriction on bases loaded)"""
|
||||
validator = GameValidator()
|
||||
state = GameState(
|
||||
game_id=uuid4(),
|
||||
@ -748,11 +748,9 @@ class TestOffensiveDecisionValidation:
|
||||
)
|
||||
decision = OffensiveDecision(action="squeeze_bunt")
|
||||
|
||||
with pytest.raises(ValidationError) as exc_info:
|
||||
# Should not raise - squeeze bunt is allowed with bases loaded
|
||||
validator.validate_offensive_decision(decision, state)
|
||||
|
||||
assert "squeeze bunt cannot be used with bases loaded" in str(exc_info.value).lower()
|
||||
|
||||
def test_validate_offensive_decision_action_squeeze_bunt_two_outs_fails(self):
|
||||
"""Test squeeze bunt with 2 outs fails"""
|
||||
validator = GameValidator()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user