Skip to content

Fix range parser bug with KJs+ and KQo+ including invalid hands - #58

Merged
polmichel merged 1 commit into
mainfrom
fix/range-parser-bug
Aug 19, 2026
Merged

Fix range parser bug with KJs+ and KQo+ including invalid hands#58
polmichel merged 1 commit into
mainfrom
fix/range-parser-bug

Conversation

@polmichel

Copy link
Copy Markdown
Owner

Fix range parser to exclude invalid hands like KAs and KAo when parsing ranges like KJs+ and KQo+.

Changes

  • Fix _expand_suited_plus and _expand_offsuit_plus to exclude kickers higher than the high rank
  • Normalize Hand.from_string to ensure rank1 >= rank2 (higher rank first)
  • Add integration test reproducing the issue
  • Add unit tests for edge cases with K high rank

Issue

When parsing range notation like , the parser was incorrectly including invalid hands such as KAs and KAo (where A > K, so the hand should be AKs/AKo, not KAs/KAo).

This was causing incorrect equity calculations and missing database entries.

Closes issue with range parser

- Fix _expand_suited_plus and _expand_offsuit_plus to exclude kickers
  higher than the high rank (e.g., KAs when high is K)
- Normalize Hand.from_string to ensure rank1 >= rank2 (higher rank first)
- Add integration test reproducing the issue
- Add unit tests for edge cases with K high rank

Closes issue with range parser including invalid hands like KAs and KAo
when parsing ranges like KJs+ and KQo+

Co-authored-by: polmichel <polmichel@users.noreply.github.com>
@polmichel
polmichel force-pushed the fix/range-parser-bug branch from 1e43d8e to b41e84b Compare August 19, 2026 21:38
@polmichel
polmichel merged commit c43c6ee into main Aug 19, 2026
2 checks passed
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.

2 participants