Skip to content

Fix baserunner resolution for Error, FieldersChoice, and DoublePlay#6

Merged
JakenHerman merged 2 commits intomasterfrom
jaken/2-baserunner-resolution
Apr 23, 2026
Merged

Fix baserunner resolution for Error, FieldersChoice, and DoublePlay#6
JakenHerman merged 2 commits intomasterfrom
jaken/2-baserunner-resolution

Conversation

@JakenHerman
Copy link
Copy Markdown
Owner

Resolves #2

Centralize baserunner logic for the three play types that previously produced inconsistent scorebook state.

  • Error: use force-advance semantics so a runner on first is preserved (was being overwritten by the batter). Bases-loaded errors now score the runner from third, still as an unearned run.
  • FieldersChoice: retire the lead forced runner (or the lead runner on base when no force exists) and advance trailing forced runners, instead of always clearing whichever highest base happened to be occupied.
  • DoublePlay: retire the runner forced from first on a standard ground- ball DP; fall back to retiring the lead runner on base for line-drive double-offs. Other runners stay put and the batter is not placed on any base.

The FC and DP logic lives on Bases (resolve_fielders_choice, resolve_double_play) so it can be reused outside of at-bat resolution.

Adds focused tests covering representative runner configurations for each play type (runner on 1st, 1st & 2nd, 1st & 3rd, bases loaded, non-forced cases, and direct Bases-helper tests).

Resolves #2

Centralize baserunner logic for the three play types that previously
produced inconsistent scorebook state.

- Error: use force-advance semantics so a runner on first is preserved
  (was being overwritten by the batter). Bases-loaded errors now score
  the runner from third, still as an unearned run.
- FieldersChoice: retire the lead *forced* runner (or the lead runner
  on base when no force exists) and advance trailing forced runners,
  instead of always clearing whichever highest base happened to be
  occupied.
- DoublePlay: retire the runner forced from first on a standard ground-
  ball DP; fall back to retiring the lead runner on base for line-drive
  double-offs. Other runners stay put and the batter is not placed on
  any base.

The FC and DP logic lives on Bases (resolve_fielders_choice,
resolve_double_play) so it can be reused outside of at-bat resolution.

Adds focused tests covering representative runner configurations for
each play type (runner on 1st, 1st & 2nd, 1st & 3rd, bases loaded,
non-forced cases, and direct Bases-helper tests).

Fixes #2
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes incorrect baserunner state transitions for Error, FieldersChoice, and DoublePlay by centralizing runner-resolution logic in Bases, and adds regression tests for representative runner configurations.

Changes:

  • Add Bases::resolve_fielders_choice and Bases::resolve_double_play, and use them during at-bat resolution.
  • Change Error handling to use force_advance semantics so forced runners advance and bases-loaded errors can score a run.
  • Add/update documentation and release-related project metadata (README install/release notes, Cargo.toml package fields, changelog, release workflow).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/game.rs Centralizes FC/DP baserunner logic; updates Error handling to preserve/advance forced runners; adds focused tests.
README.md Adds install instructions for prebuilt binaries and maintainer release steps; links changelog.
Cargo.toml Adds package metadata including rust-version, license, repository, and readme.
CHANGELOG.md Introduces a Keep-a-Changelog formatted changelog with initial release notes.
.github/workflows/release.yml Adds a tag-triggered workflow to build and attach release artifacts for major platforms.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/release.yml
Comment thread src/game.rs
Comment thread src/game.rs
Comment thread README.md Outdated
Comment thread Cargo.toml
@JakenHerman JakenHerman merged commit 75efb90 into master Apr 23, 2026
1 of 2 checks passed
@JakenHerman JakenHerman mentioned this pull request Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix baserunner resolution for errors, fielder's choice, and double plays

2 participants