|
What is the best approach to detect all possible draws of the current Holecards in combination with the current Flop/Turn/River ? Programming Language doesn't matter.. |
|
I agree with Douglas Zare, I'm just answering to get this question marked as answered. When I was writing a poker evaluator my research indicated that bitwise operations where the fastest. For example: I represented any set of poker cards as a 64 bit unsigned integer for instance : 1111000000000000000000000000000000000000000000000010000000000000 represents the poker hand 2h, 2d, 2c,2s, As. The last 12 bits are not used because there are only 52 cards in a deck. To check for each of the 10 possible straights I used bitwise ANDS. For instance to detect 2,3,4,5,6 I had a function that used bitwise AND tests to count if the hand had a 2, then a 3, etc. 2 = 1111000000000000000000000000000000000000000000000000000000000000, 3 = 0000111100000000000000000000000000000000000000000000000000000000, etc. if you counted 5 hits you had a straight, if you have 4 hits you had a 1 card straight draw. In practice: i needed code to sort out what to report when I found multiple straight draws. I had to check for stronger hands than straights first. You can write better bitwise code. This is just roughly how I happened to do it. At the time I found Cactus Kev's website was helpful: http://www.suffecool.net/poker/evaluator.html You could also just use someone elses hand evaluator, for instance: http://www.codeproject.com/KB/game/pokerhandevaldoc.aspx |
Best in what sense, and what do you count as a draw? Do you include ways that you might counterfeit or tie an opponent?
primarily im thinking of flush and straightdraws.
to detect a flushdraw shouldnt be a problem at all, but my thinking is focused on the straight-draws atm...
For each possible straight, see whether the hold card ranks union the board ranks occupy 4/5, or 3/5 for backdoor draws.