0 = High Card
1 = Pair
2 = Two Pair
3 = Set
4 = Straight
5 = Flush
6 = Full House
7 = Quads
8 = Straight Flush
I've created a function to calculate a 32 bit comparable value called the hand value. A straight flush looks like 0x00890000 in hex. Where 8 is the hand type and the rank(9) = Jack high. So we have a Jack high straight flush, not bad. The remaining ranks are not needed in this particular value as any Jack high straight flush will equate with another, thus a chopped pot.
The next step according to West (Game Developer Nov,2005) is to calculate the hand strength, a percentage value of winning, using the following algorithm:
- Create a pack of cards
- Set score to 0
- Remove the known cards (community and hole cards)
- Loop a few thousand times
- Shuffle the remaining deck
- Deal opponent's hole cards and the remaining community cards
- Evaluate all hands (using hand values) and see who has the best hand
- If agent has best hand
- Increment score by 1/number of people with same value
- Hand Strength = score/number of loops
I'm trying to stay motivated on gamedev. It has always been a rewarding part of my life and I'd like to keep it. I'll be forcing myself to make posts, even if it's just to say blah, in an effort to keep on truckn.
It would be useful if the gamedev journals allowed categories.