Fix baserunner resolution for Error, FieldersChoice, and DoublePlay#6
Merged
JakenHerman merged 2 commits intomasterfrom Apr 23, 2026
Merged
Fix baserunner resolution for Error, FieldersChoice, and DoublePlay#6JakenHerman merged 2 commits intomasterfrom
JakenHerman merged 2 commits intomasterfrom
Conversation
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
There was a problem hiding this comment.
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_choiceandBases::resolve_double_play, and use them during at-bat resolution. - Change
Errorhandling to useforce_advancesemantics 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.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #2
Centralize baserunner logic for the three play types that previously produced inconsistent scorebook state.
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).