Algorithm to determine the winner of a Texas Hold'em Hand

ULcajun picture ULcajun · Mar 14, 2011 · Viewed 14.8k times · Source

Ok, so I am making a Texas Hold'em AI for my senior project. I've created the gui and betting/dealing procedures, but I have reached the part where I need to determine who won the hand, and I do not know the best way to approach this. I am using python btw. ATM i have 2 lists, one for the 7 player cards, one for the 7 computer cards. Currently all cards are stored as a struct in the list as {'Number': XX, 'Suit': x}, where number is 2-14, suit is 1-4. The way I was going to approach this, is make a function for each hand type, starting with the highest. Eg. self.CheckRoyal(playerCards), and manually go through the list and evaluate if a royal flush was achieved. There has to be a better, numerically way to do this.

Answer

Luka Rahne picture Luka Rahne · Mar 14, 2011

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

Best algorithm you will get is 7 looks in lookup table of size 100 MB (if I remember correctly)