I am working on creating a Holdem poker calculator in python. I'm starting off by writing a simple calculator that can take two hands and calculate each hand's equity.
Here is what the program does right now: simply iterate through the 48C5 combos of flops. At each step, find each starting hand's best 5 card hand (from the 21 combinations 7c5), and finally compare the two best five card hands to see which is better or if they are tied. To do this, I created a dictionary of all 52C5 possible 5 card hands that orders them accordingly, so this is what I reference when I compare hands.
As you can imagine, this is very slow. It takes about 10 minutes to do one calculation...
What do you guys think is a better strategy for doing this? One idea to cut down on run time is to figure out some rules for dealing with multiplicities in flops. For example, different combos of AJ9105 will always have the same result if there is no flush draws.
Your strategy is a reasonable starting point. I think you should be able to do better than 10 minutes, so probably there are some optimizations you can do.
If memory isn't a factor you could pregenerate the scores for all 7 card hands, and look that up instead of doing 21 lookups per board.
There was a really good blog called "Coding the Wheel" that may interest you. I'll see if I can find it. I haven't had time to get back to the coding side of things.
"Coding the Wheel" was about writing a poker bot, although obviously there is some overlap between that and writing poker tools. I remember reading it when it came out, and I used some techniques from there for sure.