S,S,C,E=sum,sorted,combinations,enumerateĭef f(a):a=a.split() a.pop(4) e=a.pop(5)if a2]) return z or 19 # Sum up the sub-scores and if score is zero set to 19Įdit: Changed logic for fifteens and flushes. It's big and ugly (though not as big as it once was): char*L="CA23456789TJQKDHS",b,p,r,s,v,i=4,t,m,q It's impossible to score 19 points in a hand. Only maximal runs are counted, so KS QD JD TC | 9S is worth 5 points, since it is a run of 5. ![]() For example, AS AH 2D 3C | 2C (a double double run) has four runs of length 3 and two pair, so is worth 3+3+3+3+2+2 = 16 points. Triples and fours of a kind are not special - there are three pairs in a triple, so a triple is worth 6 points. Nobs: if there is a jack in hand with the same suit of the up card, add one point.If this is a crib hand, the four-point variant is not counted. Otherwise, if all but the up card are the same suit, add four points. Flush: if all five cards are the same suit, add five points.Runs: for each maximal run of consecutive cards of length longer than 2, add the length of the run in points.Pairs: for each pair of cards with the same rank (not value), add two points.Fifteens: for each subset of five cards whose sum is 15, add two points.A crib hand will have the format JD 3C 4H 5H | 5S !įace cards have a value of 10, and the ace has a value of 1. A hand will be given in the form (for example) AS 2D 3H JS | 4S There are two types of hand: normal, and a 'crib hand'.Ĭards come in the format vs where v is one of: A23456789TJQK (T for ten) and s is one of SCDH. We play with a standard poker deck, and a hand consists of four cards plus the "up card". If you don't play Cribbage, you've got some learning to do. ![]() ![]() This challenge is to score a Cribbage hand.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |