But are you really ready to process all 2598960 iterations?
Nope. The number that you mention is 52-choose-5: the number of 5-card hands possible sans restrictions. I consider only those hands that have at least one 5 in them to be interesting. This takes out a significant portion (by my math, it leaves only 886656). I will further reduce the set by using the fact that a cribbage hand is inherently non-ordered and, for my purposes, suit doesn't matter. So, I'll not bother scoring a hand if I've already seen a hand with the same cards in it. I just did it in 30 seconds, generating 1820 distinct hands. :)
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
| [reply] |
a cribbage hand is inherently non-ordered
But 52-choose-5 is non-ordered.
| [reply] |
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
| [reply] |
merlyn,
For generating all combinations of 52 cards taken 5 at a time....But are you really ready to process all 2598960 iterations? At 100 per second, that's still about a third of a day.
In cribbage, order is important contrary to what thor said earlier. The position of 1 card determines its eligibility for "right-jack" so there really are 12,994,800 hands that need to be considered. Even still, it is possible to both generate and score all those hands in under 15 minutes using pure perl. This would encompass everything thor wanted to do and a lot more.
| [reply] |
In cribbage, order is important contrary to what thor said earlier.
While you're correct in that order matters, you and I are not disagreeing. My original problem was to prove that all hands that contained a 5 had at least two points. If knobs is obtained, then a jack was cut. With at least one 5 in the hand, this will yield 2 points for the fifteen, thus satisfying the original problem.
thor
The only easy day was yesterday
| [reply] |