I am trying to develop a scoring function for 5-card draw poker hands. The scoring function must produce a partial ordering over hands, so that the score of hand 1 is less than the score of hand 2 if and only if hand 2 beats hand 1.
An example scoring function:
- Assign each hand a base score determined by the type of hand alone (e.g. pair, straight, four of a kind).
- Add additional points to the base score determined by the rank of the cards involved in the hand
- Add more points based on the side cards.
Note that each scoring tier in the above 1, 2, 3 must be less than the previous to keep the tiers seperate. So for instance, let's compare a straight and a flush.
Hand A: 3S 4C 5D 6D 7H Hand B: 2H 6H KH 4H 10H
- The Flush (hand A) will receive a base score of say 500 or 5000, and the straight will receive a 400 or 4000.
- Square each rank based on numerical value (3 = 3, 7 = 7, K = 13, A = 14) and sum (will this prevent duplicate score for different hands?)
- Since flushes use all the cards in the hand, step 3 is irrelevant.
Now let's compare two hands with 2 pairs.
Hand A: KS KH 7S 7H 3S Hand B: KC KD 7C 7D 2D
- Both hands will receive the same base score of say 200 or 2000 for the hand type (2 pairs).
- Both hands will receive the same bonus for a pair of kings and a pair of 7s (but how to make sure that the higher pair always controls and the lower pair only breaks ties).
- Hand A will receive a higher tie-breaker bonus for a 3 instead of a 2.
What algorithm will work and account for all known hands of value?