I want to create a lookup table for texas hold'em poker hands. Right now, I am using prime numbers to represent each card, and want to figure out what those cards represent as a total hand. This is because the order of the cards don't matter and the multiplication will provide us with a unique number. Now, I know about the hand evaluators, but they only evaluate the strength of the hand without draws, and do not separate the hands into as many categories as I need.
As an example take the following situation:
Hand: AdKd
Flop: Kc5d3d
(d = diamonds, c = clubs, h = hearts, s = spades)
Now, this would return from the lookup table a pair and also a flush draw.
Now this is more tricky:
Hand: AhAd
Flop: 5c5h3d
This would evaluate to overpair. So, basically, we cannot combine the hand and the flop into a single number, as we want to know exactly how the hand interacts with the flop.
I have already created a way of determining if a flush or a flush draw exists and whether a straight or a straight draw exists. So after that, the suits no longer matter, and we don't care about non-pair hands. Basically, given two numbers that represent the hand and the flop, we get back a hand category. For the last example, Aces are the prime number 41, so for the hand we get 41*41=1681 and for the board, we get 7*7*3=147. Ok now, we go to our lookup table and enter this lookup(147, 1681) and it should return OVERPAIR (or whatever constant we set it to), in constant time.
How do I implement first the lookup table? And the lookup function? (I'm already planning on using a perfect hashing algorithm for both the flop and the hand, but don't really know how to combine them.)