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

Flush evaluation is wrong #78

Open
double-free opened this issue Jan 23, 2022 · 0 comments
Open

Flush evaluation is wrong #78

double-free opened this issue Jan 23, 2022 · 0 comments

Comments

@double-free
Copy link

I know this repo is not maintained, I still post this issue here in case anyone being confused about its behavior.

Issue

Here's what I encountered:

player [SixPlayer] gets hole card ['D5', 'HA'], current stack 100
player [G7Player] gets hole card ['CQ', 'D7'], current stack 100

Street "river" started. (community card = ['DQ', 'DJ', 'D9', 'CK', 'D6'])
"['SixPlayer']" won the round 1 (stack = {'SixPlayer': 720, 'G9Player': 0, 'G5Player': 0, 'HonestPlayer': 100, 'OurPlayer': 0, 'MyPokerPlayer': 0, 'RitzPlayer': 0, 'G3Player': 80, 'G7Player': 0})

Apparently, G7 shall win the game, because it has FLUSH with "D7", but SixPlayer has FLUSH with "D5". The result is wrong.

Root cause

See here:

def __calc_hand_info_flg(self, hole, community):

The flush can not be simply represented with only the max_rank_card. In fact, we need to compare these cards one by one.

In the issue we encountered, the flush was wrongly judged as the same for both G6 and G7, and then went to the 2nd bug (mentioned here), comparing the hole card, which results in G6 as the winner.

How to fix

We have to change how the "score" is represented for FLUSH. It shall contain 5 cards, instead of only 2.

# [Bit flg of hand][rank1(4bit)][rank2(4bit)]
# shall be:
# [Bit flg of hand][rank1(4bit)][rank2(4bit)][rank3(4bit)][rank4(4bit)][rank5(4bit)]
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