more useful options PerlMonks

### Re^3: Generating all 5-card hands

by merlyn (Sage)
 on May 18, 2005 at 16:03 UTC ( #458269=note: print w/replies, xml ) Need Help??

in reply to Re^2: Generating all 5-card hands
in thread Generating all 5-card hands

a cribbage hand is inherently non-ordered
But 52-choose-5 is non-ordered.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^4: Generating all 5-card hands
by thor (Priest) on May 18, 2005 at 16:34 UTC
My point is that for the purposes of this exercise, the suit doesn't matter. So, at some point, you'll end up choosing an equivalent hand to one that has already been done. For each combination of ranks, there are a fair number of equivalent hands that differ only in the suits of the individual cards. For this exercise, those hands are equivalent, so there's no point in scoring the second hand if the first hand has already been dealt with. Perhaps I mis-spoke before.

thor

Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come

thor,
What do you mean suit doesn't matter? In cribbage, you get 4 points if all 4 cards in your hand are the same suit. If you want to prove that no hand with a 5 isn't worth at least 2 points you HAVE to consider suits. You can easily use Re: Iterating over combinations to generate the hands. The hard part is the scoring.

On the other hand, it is a lot easier to prove that there is a hand of 5 cards containing at least 1 five that is a total of less than 2 points.

• 4 cards (your hand) must not all be of the same suit
• Must not contain any cards with a value of 10
• Must not containing any combination (excluding the 5) whose sum is 10
• Must not contain any 2, 3, or 4 of a kind
• Must not have any sequence of greater than 2
I don't have an implementation yet, but it certainly does reduce the problem set.

Cheers - L~R

If you want to prove that no hand with a 5 isn't worth at least 2 points you HAVE to consider suits.
Why? You aren't interested in the case where they are the same suit. You just assume that they're not all the same suit; which suits they are is immaterial.

Caution: Contents may have been coded under pressure.
I'm attempting to prove that all hands that have a five have at least two points. That's why suit doesn't matter. Suppose that I had a hand with a 5 whose only points were a flush. Now, change the suit of one of the cards. Blamo! No more points. I maintain that such a hand does not exist. I have written the program that I intended to write (I'll try to post it once I've cleaned it up a bit), and when considering the cards without considering their suit, the minimum score was two points. You're right about your bullet points though...and we've tried to use them in a more elegant "classical" proof. :)

thor

Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come

Create A New User
Node Status?
node history
Node Type: note [id://458269]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2019-04-22 10:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
I am most likely to install a new module from CPAN if:

Results (112 votes). Check out past polls.

Notices?