NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Duplicates... (Score:1)
Alright, I see a problem. Duplicates. Eg,
K 2 2 2 2 and 2 K 2 2 2 are both the same hand, but the above considers one king-high and the other ace-high. (2s are wild.)
Not sure how to represent the problem now.
-scott
Re:Duplicates... (Score:1)
Here is my solution to the problem.
There are 40 hands that you are trying to emulate. All of the straight flushes for 4 suits from ten low down to ace low. To avoid duplicates I will only count ways of representing the best possible hand. That means we can immediately ignore the 4 hands with a low card of 2 because the wild card can represent a 7 instead for a better hand. Let's segment possibilities by how many wild cards there are, whether you are representing one of the 4 royal flushes, the 28 straight flushes with a low of 3 through 9, and the 4 straight flushes with ace low. Note that in the case of a royal flush we can replace any combination of cards. In the 3-9 case we can replace any of the top 4 cards. In the ace low we cannot replace the ace and we must use a wild for the 2.
Note that 4 wild cards is better as 5 of a kind instead of a straight flush.
So we have 4+28+0+80+448+16+240+1008+72+160+448+48 = 2552 possible hands.
This does not agree with your simulation. The two are off by 484. So where is the error? It is in confusion about what a straight flush is. To me a royal flush is just the best possible straight flush. But your simulation, and when I read more closely your root node, both indicate that you don't think that royal flushes should be counted as straight flushes. So get rid of the 4+80+240+160=484 royal flushes and our answers agree.
I hope for your sake that the Nevada gaming commission is willing to accept the simulation, because doing the math for, say, calculating full houses is beyond my patience. :-)
Reply to This
Parent
Re: (Score:1)
*sigh*. Full houses are easy. You can't have any wild cards because if you did you'd go for 4 of a kind instead. So you have 12 ways to pick the suit you're going to have 3 of a kind in, 4 choices of the cards in that kind, 11 ways to pick the one you have a pair in, and 6 choices for what the pair is. For 9504 possible full houses.
Much harder is 3 of a kind.
Re: (Score:2)
A full house with a wild card can happen. Two pair plus a wild card gives a full house. (Terminology nit: the three of a kind does not occur in a suit, but at a rank. 3 hearts and 2 spades is not a full house. :-)
Re: (Score:1)
I noticed that then decided not to reply to myself again just to point that out.
Re: (Score:1)
I skimmed this to see that you came up with basically the same final result as me and then hurriedly moved on to other things, and then got stuck again. I'm still waiting for word on whether something without a big fat E's and ()'s is acceptable.
There's two things here... I mentioned this briefly before... but again...
1. How many combinations of the 52 cards are recgognized as that hand by itself
2. How many combinations of the 52 cards are recognized as that hand when other overlapping hands are tested fir