fix(shanten): correct ukeire over-counting by subtracting hand tile copies - #174
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an over-counting bug in shanten “ukeire” (improving-tile remaining-copies) calculations by subtracting copies already in the player’s hand, aligning the feature values with actual remaining tile availability.
Changes:
- Precompute hand tile-type counts once and reuse them across iterations for both 4P and 3P code paths.
- Correct ukeire remaining-copy calculation to subtract in-hand counts in addition to visible counts.
- Add basic regression tests for 4P/3P ukeire paths under the
pythonfeature.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Owner
Author
|
I'll validate against actual tenhou game logs before merging, just to be safe. |
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 #173
The ukeire calculation only subtracted visible_counts (discards, melds, dora indicators) from the 4-copy total, ignoring tiles already in the player's own hand. This caused remaining-copy counts to be inflated (e.g. 4 instead of 1 when holding 3 copies with 0 visible).