# probability calculations (holdem poker straights)

• Jun 3, 2011, 21:30
L4suicide
probability calculations (holdem poker straights)
I have a script which has inputs of standard cards, 2 for the player, and 0, 3,4 or 5 for the community.

I have already created a working function that tells me what the possible and best hand is out of the cards given (5+ only), and working out for quads/trips/flush/pairs etc is pretty easy

But I am struggling to come up with a way of calculating which hands are still possible (providing 1 or 2 more cards to come). I was thinking of storing my hand as a string, with ace = 1, 2-9, 10 =t , 11 = j, 12=q, 13=k, ordered asc as order does not matter.
eg. 1457k, 45678, 9tjqk, 1tjqk

and then trying to do some sort of pattern matching to see how close to a straight I have.

Is there a better way of trying to calculate this?
• Jun 4, 2011, 06:33
paul_wilkins
You could loop through the groups of numbers for each straight, and count how many cards are missing to achieve a straight.

So with 1457k it would count from 1 up to 5, and record that two numbers are required. The loop that has the least number of missing cards is the best one for a straight.