The Wikipedia Poker page has numbers on the various standard poker hands, but I've been tasked with scoring odd ball hands and hands with wild cards, and furthermore, with validating my scoring logic. I have test runs, representing all 52-choose-5 [footnote 1] possible hands run through the hand recognition logic (wild cards are 2s).
I was able to predict how many hands would score as most things but the wild card straight flush has me stumped. Here's what I think the number should be and why. Tell me why I'm wrong.
I'm doing two numbers and adding them together. Hands with a logical high card (which might be a wildcard) of A K Q J 10 9 8 or 7 don't use a 2 as a 2 so they have potentially all four wild cards available (but in reality, four wilds is another hand that takes priority, so we have to subtract that out later). That's 8 possible logical high card values, times 4 suits. Then there's the exact mixture of actual non-wild cards and wild cards. The five cards composing that whatever-high straight flush can be any mixture of the non-wild normal values and the four wild cards. That's 9 cards those 5 cards are chosen from, or 9-choose-5. So 8 * 4 * 9-choose-5 which is 4032.
Then the same thing over again, but for 6 and 5 high hands, where one of the wild cards has to stand in for the actual 2: 2 high card values, 4 suits for whichever of the cards aren't wild, then a mixture of five non-wild cards and the three remaining wilds, or 8-choose-5, which is 448.
Add those for 4480. Subtract out 48+4+480 for the hands four 2s, royal flush, and wild royal flush. And it's still way off what the actual Perl scoring logic came up with: 2,068.
So, what did I do wrong, and how do I fix it?
See http://en.wikipedia.org/wiki/Binomial_coefficient for the 52-choose-5 thing. It's normally written as one number over another both surrounded by (). It's the nCr button on your calculator. For example, 52-choose-5 is 2,598,960.