# How to count the power of cards in hand?

I don't want to get the results, but to calculate them by myself.

I am a C++ programmer and I want to make for fun a program to calculate the power of cards held in hand (described as "odds"?). It's not a problem for me to think out how to do it but, I have too many ideas how to do it in my head. I think that best way will be to make a program that calculates all combinations in every phase (preflop and river look easier than flop and turn) and then it saves the results into some database (file) from which I can read after that.

Is there a good way how to count the power of the cards after flop and river? I want to do it this way: calculate chance on every possible combination (chance on 2, 2*2, poker, straight flush...); save those values separately for future use; count the same for every other possible hand, and then make some chart to calculate the relative position of my hand amongst all of those possible other hands to know how good a hand I have.

• Some1 answered me with this link: codingthewheel.com/archives/poker-hand-evaluator-roundup I haven't read it yet, but it looks like something I was searching for. Aug 29, 2012 at 16:36
• +1 to Codingthewheel.com. Very good resource. Aug 29, 2012 at 16:57
• I think the "strength of a hand" part of your question is fine, but it can be asked in a more focused way which makes it easier to answer a specific concept - otherwise there's too much territory to cover. Aug 30, 2012 at 11:39
• Yesterday I have read that codingthewheel article and its not so good, I think I can code better and faster algorithm. Aug 30, 2012 at 19:14
• That's a bold statement, although any effort to improve hand evaluators is great even though the code out there now is plenty fast :). Some areas of poker I think could use more tools are Omaha Hi (data visualization and user interface), Holdem game tree analysis (improvement on CardRunners EV and the now-defunct Pokerazor), and better poker mobile apps. Aug 31, 2012 at 14:42

## 3 Answers

"Power" of a hand is in practice an oversimplified notion. I will touch equity and your sub-question about what it says about a hand's goodness.

If you're just trying to code equity, the Coding the Wheel article others have mentioned is mandatory reading for poker coders:

http://www.codingthewheel.com/archives/poker-hand-evaluator-roundup

As for the description of hand strength in your second paragraph, preflop equity already accounts for all streets, without considering circumstances that might prevent you from seeing those streets. Basically, calculating per-street odds is unnecessary since that information is already embedded in a preflop "hot-and-cold" equity. Flopzilla is a tool that sounds vaguely like what you're describing:

http://www.cardrunners-ev-calculator.com/Flopzilla.html

Your line of thinking - ranking a hand by its street-specific "power" - is similar to the function provided by ProPokerTools' equity graphs:

http://www.propokertools.com/help/simulator_docs#graph

These graphs show minimum equities for proportions of possible flops against a hand or range, and are often cited as evidence of a hand's playability, a concept that is particularly relevant in big bet Holdem.

Much work has been done in the ranking of hands, but rankings tend to have limited usefulness in big bet games and are mostly useful for studying limit games and tournament push-fold situations:

http://www.bigbetsoftware.com/holdemviewer/rankings/

(Disclosure: I am the author of the software in the above link.)

The prevailing philosophy in modern big bet games, particularly in No Limit Holdem, is that hands don't have absolute preflop value and depend on situation-specific ranges and positions (except for premium hands in most cases).

If your question simply boils down to charting equity, this has been done to death - you can find such a table here:

http://www.pokerstove.com/blog/holdem-preflop-matchups/

This table is useful to check your calculations against if you just mean to write the code as practice. A good supplement to the Coding the Wheel article, if you're looking for algorithms to study, is this thread on hand evaluator performance:

http://pokerai.org/pf3/viewtopic.php?f=3&t=16

• I will definitely check those links! Aug 30, 2012 at 20:26
• So I have checked many links including these here and your software looks the best among the calculators I have seen. But I don't play poker so much, so it's too much functions for me, but I like the look and the control. I have seen also many graphs and tables today, so soon I will try to start coding something by myself. I must think about many questions, because I seen strange things like 99 is stronger than AKs, but AKs has much higher EV etc, I don't understand these things for now. Aug 31, 2012 at 17:27

There are too many variables to consider. That includes card odds, pot odds, classification of other players (based on history), position and so on. To create AI like that you need to master your poker skills first ;)

• I know and thank you, I have written on a paper 5 levels of things, what to do and the first thing is mastering the odds and creating a structure to save every useful information about the table. For now, I don't care about bets, position, classification of players etc. Aug 29, 2012 at 16:31

I would start by adding the "pips" of the cards (11 for jacks, 12 for queens, 13 for kings, 14 for aces, etc.

Then I would add bonuses for pairs, common suit, and "connectedness." That's the tricky part. I have my own proprietary formulas, which I won't disclose.