PDA

View Full Version : Eureka! Probability of flopping a straight.

VivaLaViking
08-05-2005, 02:35 PM
I believe I have succeeded in writting some reasonably concise code for calculating the probabilty of flopping a straight depending on the separation of the hole cards. Turn and river calculation will follow later. Can anyone post known probabilities to use as a benchmark? I have been wrong before and I don't trust myself. Afterall, I've got myself in more trouble than other people have got me into. I will explain the code to anyone interested.
[ QUOTE ]

// T -&gt; A converted to 10 -&gt; 14 except when A is low, then it's one.
// the LowCard and HiCard have been resolved.

Separation = HiCard - LowCard;
FlopStraightProbabilityRatio = 0;
if((Separation &lt;= 4) &amp;&amp; (Separation &gt; 0)) { // If a straight is possible
. . . if(LowCard &lt; 5) SolutionsAdjustForBounds = LowCard;
. . . else if(HiCard &gt; 10) SolutionsAdjustForBounds = 15 - HiCard;
. . . else SolutionsAdjustForBounds = 5 - Separation;

. . . MaxSolutions = 5 - Separation;
. . . Solutions = (MaxSolutions - SolutionsAdjustForBounds) &gt; 0? MaxSolutions -
. . . . . .(MaxSolutions - SolutionsAdjustForBounds): MaxSolutions;
. . . Permeations = Solutions * 384;
. . . FlopStraightProbabilityRatio = Permeations / 19600 (50 C 3);
}

[/ QUOTE ]

jba
08-05-2005, 03:31 PM
explain the 384 number for me. better yet just include the equation in the code computers are pretty good at calculating stuff fast.

and I have to nit at this:

just make it

just say what you mean

VivaLaViking
08-05-2005, 04:02 PM
For a given two down cards a straight may have a possible solution. Assume the solution is 7 8 9. Those numbers have be permeated 6 ways but considering the 3 suited values it results in 6 * 4 * 4 * 4 = 384 permeations. A number without any comment is referred to in computerese as a "magic number". It is considered a faux pas. Sorry.

TonyBlair
08-06-2005, 10:17 AM
.

emp1346
08-06-2005, 08:43 PM
[ QUOTE ]
.

[/ QUOTE ]

Thank you SO much for this very, very insightful post... I mean what more can anyone say than "."?

Anyway, as for the code, looks like it [i]should work... Good job... You need to make sure the 50c3 is commented instead of parenthesized, but I hope it works!

VivaLaViking
08-07-2005, 07:28 PM
This code should serve you better. It reavealed something interesting to me. On a flop if the are N solutions for a straight, the probability is 2% x N. eg assume you have Q J for down cards so the solutions are A K T, K T 9 and T 9 8 so the probalility for the three solutions is 6%. The actual numbers are ~1.95% ~3.91% ~5.87% and ~7.83% but when you're sitting at a table, 2%, 4%, 6% and 8% are close enough.

// the LowCard and HiCard have been resolved.
int nLowCard = nValue2;
int nHiCard = nValue1;
int nSeparation = nHiCard - nLowCard;
double dFlopStraightProbabilityRatio = 0;
if(nSeparation &lt;= 4) { // If a straight is possible
int nMaxSolutions = 5 - nSeparation;
int nSolutionsReducedByBounds = 0;

// only low straights will satify this
// conditional. Either the separation will be too great
// and it will never test the condition or the low
// straight is not being considered this iteration.
if((4 - nSeparation) &gt;= nLowCard)
nSolutionsReducedByBounds = nMaxSolutions - nLowCard;

// only high straights will satify this conditional.
// Either the separation will be too great and it will
// never test the condition or the high straight is not
// being considered this iteration.
else if(nLowCard &gt;= 11)
nSolutionsReducedByBounds = nLowCard - 10;

// 384 = 6 permeations solution x (4 C 1) cubed(suits)
int nPermeations = (nMaxSolutions -
nSolutionsReducedByBounds) * 384;

// 19300 = (50 C 3) // the total possible flops
dFlopStraightProbabilityRatio = ((double)nPermeations) /
((double)19600);