# How to calculate pre-flop odds with hands revealed?

I’m trying to create a backend for a Poker odds calculator.

I know how to go about calculating odds post-flop, but I’m having a hard time calculating the odds pre-flop.

How do I go about calculating pre-flop odds with all the hands involved revealed? like in an all-in situation.

• there are many common hand vs hand known percentages out there for heads up. for example 2 overcards vs a pair or an over-under hand vs a hand in the middle (ex. AT vs KQ). you may be able to incorporate these known percentages – Clarko Jan 31 at 0:00

You can do this through simulation, but that might not be very convenient if you are writing a backend. I would start with the following method:

• keep track of which hand is the best before any cards are dealt (AT > KQ, 33 > 22, 55 > AK)
• calculate any possible outs that the worse hand could hit to become the best hand, including any possible straights or flushes
• start each of the worse hands at 0% and the best hand at 100%, then for each out the worse hands have, add the probability that they will hit that out in the next 5 cards to their total while subtracting that from the total of the best hand.

With more than 2 hands all-in it gets a little murky doing it this way, you will have to split up the probability subtraction part among multiple hands. You can easily experiment and adjust using tools like pokerstove that do run large numbers of simulations and compare that to your results.

Also keep in mind that because there are no draws preflop, you can hard code some percentages for a hand to hit a flush/straight. With 2 suited cards there is ~6% chance of hitting a flush by the river. With non-connected cards there is a probability of hitting a 4 card straight and connected cards have a constant probability of hitting a straight based on how big the gap between the cards is.