Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 782
ULcajun Avatar asked Mar 14 '11 00:03

ULcajun


People also ask

How do you determine who wins a hand in poker?

If two or more players have the same hand the high card determines the winner. For straights or flushes, the highest top card is declared the winner. For one pair and two pair hands, the highest kicker wins. If players have the same 5-card hand, it is a tie and the pot is split equally.

Is there an algorithm for poker?

Effective Hand Strength (EHS) is a poker algorithm conceived by computer scientists Darse Billings, Denis Papp, Jonathan Schaeffer and Duane Szafron that was published for the first time in the research paper (1998).


1 Answers

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)

like image 151
Luka Rahne Avatar answered Sep 27 '22 02:09

Luka Rahne