HenryRLee / PokerHandEvaluator

Poker-Hand-Evaluator: An efficient poker hand evaluation algorithm and its implementation, supporting 7-card poker and Omaha poker evaluation
Apache License 2.0
372 stars 80 forks source link

Exactly 2 hole cards not considered in Omaha #81

Closed ykcodebook closed 12 months ago

ykcodebook commented 12 months ago

I tried to evaluate a hand for omaha and this is my hand used.

p3 = evaluate_omaha_cards("3s", "5h", "Qs", "Qd", "9h", "Ks", "8c", "Js", "5c")

This results with ranking of 2788 which is Two Pair (Qs Qd 5h 5c) which is wrong since only one card from the hole is considered for the evaluation.

Any solution for this?

HenryRLee commented 12 months ago

Hi @ykcodebook , the evaluation is correct.

The final 5 cards that made the two-pair should be "Qs", "Qd", "5h", "5c", "Ks". It's picking exactly three cards from the community cards and two cards from the hole cards.

azriel1rf commented 12 months ago

@ykcodebook @HenryRLee I've revisited this scenario to confirm, and it appears to be expected behavior.

Community cards: "3s", "5h", "Qs", "Qd", "9h" Hole cards: "Ks", "8c", "Js", "5c"

Selected hand: "Qs", "Qd", "5h", "5c", "Ks"

from phevaluator import evaluate_omaha_cards, evaluate_cards

print(evaluate_omaha_cards("3s", "5h", "Qs", "Qd", "9h", "Ks", "8c", "Js", "5c"))  # 2788
print(evaluate_cards("Qs", "Qd", "5h", "5c", "Ks"))  # 2788

Here, both evaluate_omaha_cards and evaluate_cards functions return 2788, confirming that the evaluation is consistent and adheres to the rules of Omaha poker.

ykcodebook commented 12 months ago

Thanks! I may have misunderstood the rule of omaha. Appreciate the quick reply.