Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > General Gambling > Probability
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-04-2006, 10:51 PM
uDevil uDevil is offline
Senior Member
 
Join Date: Jul 2003
Location: Cloudless climes and starry skies.
Posts: 2,490
Default Counting the Nuts (long)

I wrote a little program ( Nuts! ) using my own crude hand evaluation function. I'd like to check it by calculating the expected proportion of each type of potential nut hand on a 5-card Hold'em board. I'd like to do this in pieces. Please check my math and reasoning or suggest a simpler way if possible.

[img]/images/graemlins/diamond.gif[/img] First, the total number of 5-card boards is C(52,5)= 2598960.

[img]/images/graemlins/diamond.gif[/img] Second, the number of boards where a straight flush is possible is 64*C(4,1)*C(49,2)=301056.

The factor 64 comes from enumerating all possible 3-straights for the 13 ranks in the deck, as follows:

A-high 3-straights: AKQ, AKJ, AKT, AQJ, AQT, AJT
....
There are 6 3-straights for each rank from K-high to 5-high
....
4-high: 432, 431, 421,
3-high: 321

So there are 10*6+4=64 possible 3-straights.

Having chosen a 3-straight, there are 4 ways to choose a suit for a 3-straight flush. Lastly, we choose 2 more cards from the remaining 49.

So the proportion of total hands where the nut hand is a straight flush is

301056/2598960= 0.115837104

[img]/images/graemlins/diamond.gif[/img] Third, the total number of quad boards of different types is

<font class="small">Code:</font><hr /><pre>
XXYYY 3744= 13*C(4,2)*12*C(4,3)
XXYYZ 123552= 13*C(4,2)*12*C(4,2)*10*4
XXYZW 1098240= 13*C(4,2)*C(12,3)*4^3
XXXYZ 54912= 13*C(4,3)*C(12,2)*4^2
XXXXY 624= 13*12*4
Total 1281072
</pre><hr />

Where W, X, Y, and Z are distinct card ranks. So for example XXYYZ is a 2-pair board.

But some boards where quads are possible also make straight flushes possible. The number of such boards is

<font class="small">Code:</font><hr /><pre>
XaYaZaWW 15360= 256*C(10,1)*C(4,2)
XaYaZaZW 92160= 256*3*3*C(10,1)*4
XaYaZaYZ 6912= 256*C(3,2)*3*3
XaYaZaXX 2304= 256*C(3,1)*3
total 116736
</pre><hr />

Where XaYaZa is a 3-card straight flush (X, Y, Z are not necessarily sequential ranks). The factor 256 comes from the 64 possible 3-straights and 4 choices of suit for the straight flush.

Hence the proportion of boards where quads are the nuts is

(1281072-116736)/2598960=0.448000739

More to follow....
Reply With Quote
  #2  
Old 08-05-2006, 12:49 AM
Tom1975 Tom1975 is offline
Senior Member
 
Join Date: Jun 2005
Posts: 932
Default Re: Counting the Nuts (long)

You're overcounting your straight flushes. For example:

First, I pick my 3-straight. Ok, let's say AKQ. Now I pick my suit, let's say diamonds. Now I pick my last two cards, let's say J [img]/images/graemlins/diamond.gif[/img]T [img]/images/graemlins/diamond.gif[/img]. Final board: AKQJT in diamonds.

Now lets do another one. This time I'll pick AJT as my 3-straight. I'll now pick diamonds again as my suit. Now I'll pick K [img]/images/graemlins/diamond.gif[/img]Q [img]/images/graemlins/diamond.gif[/img]. Final board: AKQJT in diamonds.

Your methods counts these as two seperate boards when they are in fact identical.
Reply With Quote
  #3  
Old 08-05-2006, 01:34 PM
bigpooch bigpooch is offline
Senior Member
 
Join Date: Sep 2003
Location: Hong Kong
Posts: 1,330
Default Re: Counting the Nuts (long)

Interesting question! It's tedious (but not difficult) to
answer this. You did overlook some double counting in your
post as mentioned.

STRAIGHT FLUSH
---------------

If a straight flush is possible (including one on board),
there could be five, four or three cards of a suit:

five) It's useful to know there are 79 combinations of
five different ranks of the C(13,5) = 1287 that do not
make a straight possible (it's a bit tedious if one
hasn't listed these combinations before), so there are
1208 combinations that do.

Thus, there are 1208*4 = 4832 combinations altogether.

four) It's useful to know there are 283 combinations of
four unique ranks that do not make a straight possible
of the C(13,4) = 715 total combinations, so there are
432 combinations that do. Here, you can simply count
the combinations from AK-high to 87-high that don't
allow for a possible straight (it's a bit tedious, but
it's not hard).

There are 432*4*39 = 67392 combinations altogether.

three) Now, there are 64*4*C(39,2) = 189696 combinations.


Adding, there are 261920 boards where a straight flush
is the "nuts".

The proportion is 0.100778773


QUADS
-----

Clearly, a pair is on board, so as any mathematical draw
player would know, there are 624 quads, 3744 full houses,
54912 trips, 123552 two pairs, and 13*84480 = 1098240
pairs in draw. Now, sometimes a straight flush is
possible, so it's important to subtract these:

pair) With a four flush, there are 432 combinations of
four different ranks that allow for a straight, so there
are 432*4*4*3 = 20736 of these. With only a three-flush,
there are 64*4*3*3*10*3 = 69120 of these where there is
pair of one of the three ranks of the three-flush and
64*4*10*3 = 7680 where the pair is of a different suit.
Altogether, a straight flush is possible on 97536
combinations.

two pairs) Your calculation of 6912 is correct.

trips) Your calculation of 2304 is correct.

full house or quads) No adjustment is required.

The total number of boards where quads is the nuts is
1281072 - (97536 + 6912 + 2304) = 1174320 combinations.

The proportion is 0.451842275


[Obviously, if a pair is not on board and a straight
flush is possible, the nuts could only be a flush, a
straight or trips.]


FLUSH
-----

It's possible that five cards of the same suit are on
board without a straight flush being possible and there
are 79*4 = 316 combinations of those.

For four cards of the same suit, there are 283 kinds of
boards that do not allow for a possible straight flush.
Thus, there are 283*4*9*3 = 30564 combinations when the
board has four cards of the same suit.

For only three cards of the same suit, there are 64
kinds that admit for a straight flush out of the total
C(13,3) = 286 kinds; thus, there are 222 kinds that do
not allow for a straight flush. Thus, there are
222*4*C(10,2)*3*3 = 359640 combinations.

Altogether, there are 390520 combinations.

The proportion is 0.150260104


STRAIGHT
--------

There are 1287 - 79 = 1208 combinations of the ranks that
allow for a straight. Out of the 4^5 = 1024 combinations
of suits that can be allowed that do not include three or
more cards of a suit, you could have every suit or two
suits of two cards each. With every suit, there are
4*C(5,2)*3*2 = 240 combinations and for the other type,
there are 4*5*3*C(4,2) = 360 so altogether, there are
600 allowable suit combinations. Thus, there are

724800 combinations.

The proportion is 0.278880783


TRIPS
-----

There are 79*600 = 47400 combinations.

The proportion is 0.018238064



Fortunately, adding up the combinations above yields
2598960 as expected!

Anyone care to check this? [img]/images/graemlins/smile.gif[/img]
Reply With Quote
  #4  
Old 08-05-2006, 08:37 PM
uDevil uDevil is offline
Senior Member
 
Join Date: Jul 2003
Location: Cloudless climes and starry skies.
Posts: 2,490
Default Re: Counting the Nuts (long)

Tom1975-- thanks.

BigPooch-- that's awesome! If you're right, I may not doing any better as a programmer than I am at counting [img]/images/graemlins/frown.gif[/img]

Reply With Quote
  #5  
Old 08-10-2006, 06:02 PM
uDevil uDevil is offline
Senior Member
 
Join Date: Jul 2003
Location: Cloudless climes and starry skies.
Posts: 2,490
Default Re: Counting the Nuts (long)

[ QUOTE ]
Anyone care to check this? [img]/images/graemlins/smile.gif[/img]

[/ QUOTE ]

Just wanted to say I went over it in detail and found no errors. I almost went blind counting nonstraight boards, but I found no errors.

The problem with my program was not in the hand evaluation, but in the shuffle, which was not sufficiently random. After substituting a Fisher-Yates shuffle function, the results are



I'm calling it good. Thanks again! [img]/images/graemlins/smile.gif[/img]
Reply With Quote
  #6  
Old 08-11-2006, 02:37 AM
bigpooch bigpooch is offline
Senior Member
 
Join Date: Sep 2003
Location: Hong Kong
Posts: 1,330
Default Re: Counting the Nuts (long)

Your welcome!

[ QUOTE ]
I almost went blind counting nonstraight boards

[/ QUOTE ]

Well, that's not so bad for five different ranks, but for
four different ranks, it's tedious. At least your program
now seems to shuffle the cards fairly! There WAS a poker
site that was infamous for having an "incorrect shuffling
algorithm", but I won't mention names! [img]/images/graemlins/smile.gif[/img]
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:39 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.