Skip to content

fix: prevent underflow in ukeire calculation - #189

Merged
smly merged 2 commits into
mainfrom
fix/prevent-underflow-ukeire-calc
Mar 17, 2026
Merged

fix: prevent underflow in ukeire calculation#189
smly merged 2 commits into
mainfrom
fix/prevent-underflow-ukeire-calc

Conversation

@smly

@smly smly commented Mar 17, 2026

Copy link
Copy Markdown
Owner
  • Use saturating_sub instead of plain subtraction in calculate_best_ukeire and calculate_best_ukeire_3p to prevent u32 underflow when visible tile counts exceed the remaining copies of a tile type.
  • Add regression tests for both 4-player and 3-player variants to verify the saturation behavior.

@smly smly self-assigned this Mar 17, 2026
@smly
smly merged commit 7b1b2d1 into main Mar 17, 2026
7 checks passed
@smly
smly deleted the fix/prevent-underflow-ukeire-calc branch March 17, 2026 13:19
@smly smly changed the title fix: prevent u32 underflow in ukeire calculation fix: prevent underflow in ukeire calculation Mar 17, 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.

1 participant