In Cribbage, a hand scores as follows:
2 points for each set of cards that totals 15 (face cards count 10, aces count 1)
2 points for each pair (this means 3ofakind is worth 6 points and 4ofakind is worth 12 points)
n points for each maximal straight containing n cards (i.e. a four card straight does not also count as two three card straights)
n points for each maximal flush containing n cards (i.e. a four card flush does not also count as four three card flushes)
1 point for the jack of trumps
It's easy to show that the best five card hand is
J5555, worth 29 points, and, although impossible in an actual game, the best six card hand would be 445566, worth 46 points.
If the entire deck of 52 cards was considered to be a single cribbage hand, what would be its value?
(In reply to
Hey Charlie by tomarken)
You're right. the corrected program counts 32,064 ways of totaling 15, for a 64,128 contribution to the total points. I see this disagrees with Eric's total. I'll have to see in the morning where the discrepancy lies.
The corrected core of the program:
IF tot9 = 15 THEN
ways = 4 ^ den(1) * 6 ^ den(2) * 4 ^ den(3)
overTot = overTot + ways
ELSEIF tot9 = 5 THEN
ways = 4 ^ (den(1) + 1) * 6 ^ den(2) * 4 ^ den(3)
overTot = overTot + ways
END IF

Posted by Charlie
on 20060608 00:19:03 