brunoscopelliti / poker-holdem-engine

Texas hold'em poker engine
MIT License
110 stars 50 forks source link

Poker Hand Rank Miscalculation #7

Closed stephclleung closed 5 years ago

stephclleung commented 5 years ago

Hello,

We are in the middle of a test game when we came across this situation: image

Our common cards were

[{ "rank": "J", "type": "D" }, { "rank": "10", "type": "C" },
 { "rank": "Q", "type": "S" }, { "rank": "K", "type": "S" },
 { "rank": "9", "type": "S" }]

and our player were

    "players": [
        {
            "state": "active", "cards": [
                { "rank": "9", "type": "C" }, { "rank": "2", "type": "S" }],
            "chips": 29800, "chipsBet": 20200, "already_bet": true
        },
        {
            "state": "active", "cards": [
                { "rank": "J", "type": "H" },
                { "rank": "K", "type": "H" }],
            "chips": 29800, "chipsBet": 20200, "already_bet": true
        },
        {
            "state": "active", "cards": [
                { "rank": "Q", "type": "C" }, { "rank": "4", "type": "H" }],
            "chips": 29800, "chipsBet": 20200, "already_bet": true
        },
        {
            "state": "active", "cards": [
                { "rank": "Q", "type": "H" }, { "rank": "8", "type": "D" }],
            "chips": 29800, "chipsBet": 20200, "already_bet": true
        }],

Our frontend for a easier understanding: image

From our end, it seems like the engine marked Stephanie as a winner because everyone had a Straight of K and Stephanie was the first player on the list. Is this the expected behavior?

By card ranking, wouldn't the winner be Brian, who has the highest kicker card? If the 6th kicker card is not counted, was there suppose to be more than one winner?

Thank you for your time.

brunoscopelliti commented 5 years ago

In this case I would expect a plot split between all the players, because everyone has a Straight to K. Brian doesn't win, cause eveyone has a K (the K on the table)... in the straight there're no kickers, cause all the 5 cards are considered to form the points. If you told me that Stephanie won the whole the pot, that's unexpected. Would you like to help me by preparing a failing test case? I won't have enough time to watch into this before a week, or something more.

stephclleung commented 5 years ago

Hello @brunoscopelliti ! I'm happy to prepare a test case! It would be my first attempt at contributing to open source. But I am occupied by this graduation project now. I will try to prepare the test case soon as I can. Thank you again for your reply!

brunoscopelliti commented 5 years ago

I managed to reproduce the bug. Thank you for the report.

brunoscopelliti commented 5 years ago

I've published version 3.0.2 that fixes this issue.

@stephclleung Thank you for reporting it to me.