Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs in HandRange.fromCardPairs function #34

Open
eRaMvn opened this issue Sep 7, 2022 · 0 comments
Open

Bugs in HandRange.fromCardPairs function #34

eRaMvn opened this issue Sep 7, 2022 · 0 comments

Comments

@eRaMvn
Copy link
Contributor

eRaMvn commented Sep 7, 2022

Hi,

I think there is a bug in the fromCardPairs function. Here is the test code where I found the bug in version 0.10.0

Set<CardPair> test = HandRange.parse('JJ-4498s').cardPairs.toSet();
test.remove(CardPair.parse('4s4d'));
test.remove(CardPair.parse('4h4d'));
test.remove(CardPair.parse('4d4c'));
test.remove(CardPair.parse('4s4c'));
test.remove(CardPair.parse('4h4c'));
test.remove(CardPair.parse('4d4c'));
print(test);
//Output: {(Js, Jh), (Js, Jd), (Js, Jc), (Jh, Jd), (Jh, Jc), (Jd, Jc), (Ts, Th), (Ts, Td), (Ts, Tc), (Th, Td), (Th, Tc), (Td, Tc), (9s, 9h), (9s, 9d), (9s, 9c), (9h, 9d), (9h, 9c), (9d, 9c), (8s, 8h), (8s, 8d), (8s, 8c), (8h, 8d), (8h, 8c), (8d, 8c), (7s, 7h), (7s, 7d), (7s, 7c), (7h, 7d), (7h, 7c), (7d, 7c), (6s, 6h), (6s, 6d), (6s, 6c), (6h, 6d), (6h, 6c), (6d, 6c), (5s, 5h), (5s, 5d), (5s, 5c), (5h, 5d), (5h, 5c), (5d, 5c), (4s, 4h), (8s, 9s), (8h, 9h), (8d, 9d), (8c, 9c)}

HandRange parsed_test = HandRange.fromCardPairs(test);
print(parsed_test.cardPairs.toSet());
//Output:  {(Js, Jh), (Js, Jd), (Js, Jc), (Jh, Jd), (Jh, Jc), (Jd, Jc), (Ts, Th), (Ts, Td), (Ts, Tc), (Th, Td), (Th, Tc), (Td, Tc), (9s, 9h), (9s, 9d), (9s, 9c), (9h, 9d), (9h, 9c), (9d, 9c), (8s, 8h), (8s, 8d), (8s, 8c), (8h, 8d), (8h, 8c), (8d, 8c), (7s, 7h), (7s, 7d), (7s, 7c), (7h, 7d), (7h, 7c), (7d, 7c), (6s, 6h), (6s, 6d), (6s, 6c), (6h, 6d), (6h, 6c), (6d, 6c), (5s, 5h), (5s, 5d), (5s, 5c), (5h, 5d), (5h, 5c), (5d, 5c), (8s, 9s), (8h, 9h), (8d, 9d), (8c, 9c)}

Notice that we are missing (4s, 4h). I think something is wrong with HandRange.fromCardPairs() function

Thank you!

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

No branches or pull requests

1 participant