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 3-of-a-kind is worth 6 points and 4-of-a-kind 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?
Since we're talking maximal straights and flushes, answers to the questions about 2-card-straights and 2-card-flushes from my previous post don't matter.
The pairs, straights, flushes and jack are fairly easy without the computer. The cards totaling 15 require, for me, the computer.
There are 4 of each of 13 denominations, so the pairs account for a total of 12*13 points = 156 points.
The maximal straights are 13 long and so account for 13 points each. For each denomination within this type of straight there are 4 choices of card (4 suits). So straights account for 13*4^13 points or 872,415,232 points.
The maximal flushes contain 13 cards and there are 4 of them, for a total of 13*4 = 52 points.
There's one Jack of trump, for 1 point.
The following program counts the number of ways of getting a set of cards totaling 15:
DEFDBL A-Z
FOR no1 = 0 TO 4
cdCt = no1: tot = no1
den(no1) = 1
FOR no2 = 0 TO 4
cdCt2 = cdCt + no2: tot2 = tot + 2 * no2
den(no2) = den(no2) + 1
FOR no3 = 0 TO 4
cdCt3 = cdCt2 + no3: tot3 = tot2 + 3 * no3
den(no3) = den(no3) + 1
FOR no4 = 0 TO 3
cdCt4 = cdCt3 + no4: tot4 = tot3 + 4 * no4
den(no4) = den(no4) + 1
FOR no5 = 0 TO 3
cdCt5 = cdCt4 + no5: tot5 = tot4 + 5 * no5
den(no5) = den(no5) + 1
FOR no6 = 0 TO 2
cdCt6 = cdCt5 + no6: tot6 = tot5 + 6 * no6
den(no6) = den(no6) + 1
FOR no7 = 0 TO 2
cdCt7 = cdCt6 + no7: tot7 = tot6 + 7 * no7
den(no7) = den(no7) + 1
FOR no8 = 0 TO 1
cdCt8 = cdCt7 + no8: tot8 = tot7 + 8 * no8
den(no8) = den(no8) + 1
FOR no9 = 0 TO 1
cdCt9 = cdCt8 + no9: tot9 = tot8 + 9 * no9
den(no9) = den(no9) + 1
IF tot9 = 15 THEN
ways = 4 ^ den(1) * 6 ^ den(2) * 3 ^ den(3)
overTot = overTot + ways
ELSEIF tot9 = 5 THEN
ways = 4 ^ (den(1) + 1) * 6 ^ den(2) * 3 ^ den(3)
overTot = overTot + ways
END IF
den(no9) = den(no9) - 1
NEXT
den(no8) = den(no8) - 1
NEXT
den(no7) = den(no7) - 1
NEXT
den(no6) = den(no6) - 1
NEXT
den(no5) = den(no5) - 1
NEXT
den(no4) = den(no4) - 1
NEXT
den(no3) = den(no3) - 1
NEXT
den(no2) = den(no2) - 1
NEXT
den(no1) = 0
NEXT
PRINT overTot
The central algorithm is
ways = 4 ^ den(1) * 6 ^ den(2) * 3 ^ den(3)
where den(1) keeps track of how many denominations are represented by 1 card; den(2) by 2 cards; den(3) by 3 cards.
For each denomination represented by 1 card, there are 4 choices of that card; for each that is represented by 2 cards there are 6 choices of those two suits; and for each that is represented by 3 cards, there are 3 ways of choosing those 3 suits. When the total of 15 is accomplished without any value-10 cards, this is added in to the overall total. When the total is 5, one 10 card brings it to 15, and so 1 is added to the number of denominations with one card represented.
The program finds 15,028 ways, for a total of 30,056 points.
These all add up to 872,445,497 points.
Edited on June 7, 2006, 3:48 pm
|
Posted by Charlie
on 2006-06-07 15:38:26 |