|
#1
|
|||
|
|||
Eureka! Probability of flopping a straight.
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 -> A converted to 10 -> 14 except when A is low, then it's one. // the LowCard and HiCard have been resolved. Separation = HiCard - LowCard; SolutionsAdjustForBounds = 0; FlopStraightProbabilityRatio = 0; if((Separation <= 4) && (Separation > 0)) { // If a straight is possible . . . if(LowCard < 5) SolutionsAdjustForBounds = LowCard; . . . else if(HiCard > 10) SolutionsAdjustForBounds = 15 - HiCard; . . . else SolutionsAdjustForBounds = 5 - Separation; . . . MaxSolutions = 5 - Separation; . . . Solutions = (MaxSolutions - SolutionsAdjustForBounds) > 0? MaxSolutions - . . . . . .(MaxSolutions - SolutionsAdjustForBounds): MaxSolutions; . . . Permeations = Solutions * 384; . . . FlopStraightProbabilityRatio = Permeations / 19600 (50 C 3); } [/ QUOTE ] |
#2
|
|||
|
|||
Re: Eureka! Probability of flopping a straight.
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: (MaxSolutions - SolutionsAdjustForBounds) > 0 just make it (MaxSolutions > SolutionsAdjustForBounds) just say what you mean |
#3
|
|||
|
|||
Re: Eureka! Probability of flopping a straight.
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.
|
#4
|
|||
|
|||
Re: Eureka! Probability of flopping a straight.
.
|
#5
|
|||
|
|||
Re: Eureka! Probability of flopping a straight.
[ QUOTE ]
. [/ QUOTE ] Thank you SO much for this very, very insightful post... I mean what more can anyone say than "."? [I'll just self-censor myself here.] Anyway, as for the code, looks like it should work... Good job... You need to make sure the 50c3 is commented instead of parenthesized, but I hope it works! |
#6
|
|||
|
|||
Re: Eureka! Probability of flopping a straight.
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 <= 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) >= 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 >= 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); |
|
|