0

I am trying to find a way to calculate the strength of a hand, specifically how many unique hands (of the 169 starting hands) have a higher chance of winning at showdown given a complete or incomplete board (holdem).

I've tried to do this a few ways and have been somewhat successful but it takes an obnoxious amount of time for my program to run given that i'm essentially branching out for every possible hand combo, and comparing aggregate results for every scenario to find how many hands are better than hero's. TLDR it's terribly inefficient and it takes an unrealistic amount of time to run.

However there are tools like this one http://www.cardplayer.com/poker-tools/odds-calculator/texas-holdem that seem to do the calculation a lot faster. The above program seems to do calculations for all possible future board combinations, so it can give you the better hand for incomplete boards. Although, for my particular program i'd like to find the number of hands ahead of hero's at any given point, which would require me to run the program above for each of the 52*51 non-unique starting hands, and find my hand's place among the rest and once the number of better hands have been gotten, i'll have to reduce those to unqique starting hands (ie 8c7h and 8h7c would be reduced to 87o)

So my question is, are there any tools/frameworks/references (preferably in Java) out there for calculating the strength of hero's hand vs an anonymous hand given any complete or incomplete board that also doesn't take a day to run?

Ben Arnao
  • 88
  • 1
  • 9
  • Use Monte Carlo Simulation, just play out thousands of games efficiently against random hands and boards, this will take less than a second. – maraca Apr 19 '17 at 00:36

2 Answers2

1

I am not much of a poker kind of guy, but you may find ThePokerBank site interesting, what about a whole course dedicated at poker theory from MIT, a bonus infographic to help you out too.

There are different strategies that you can take to try to tackle this issue, all of them involving quite some knowledge on Statiscal analysis, I would say that one of the reason other poker algorithm work a bit better is that they are using a form of vectorization math instead of a series of for loop. I know that language like octave/MatLab/R take this strategy to do bulk operation.

Good luck and have fun!!

cabolanoz
  • 304
  • 1
  • 9
0

This thread has much information Stack Overflow Evaluation Algorithms

Also at Code Project and a tutorial on an algorithm and Java source: at Github and in different languages at rosettacode.

Community
  • 1
  • 1
Darrell Ulm
  • 132
  • 1
  • 2
  • 11
  • I have code that tells me the strength of a hand fairly quickly. That's not where the bottle neck is. The problem i am running into is for calculating the number of unique hands ahead the hero, i have to compare all hands for all possible board combinations. And then compare those results, and then reduce to unique hands. – Ben Arnao Apr 18 '17 at 22:27
  • So this question is looking for the probabilities of the various hands, i.e. 52 choose 5 for any hand, and 4 choose 1 for a royal flush for instance, but possibly given all the cards already seen? – Darrell Ulm Apr 19 '17 at 15:12
  • The question is how many unique hands are ahead of hero's for a given board. There are 169 unique starting hands, so the function should essentially be int(returns 0-168) getHandsAhead(Hand heroHand, Board currBoard) – Ben Arnao Apr 19 '17 at 22:41