Saturday, June 13, 2009

Texas Hold'em evaluator

Recently I read about Poker Hand Evaluators (especially on the 2 + 2 Forum). I spent a lot of time thinking about improvement of the Cactus Kev algorithm and I decided to give a try to the Finite State Machines.


We have 52 cards and we want to evaluate 7-cards Texas Hold'em hand. Simple calculations show us that there is "only" 674,274,182,400 hand permutations. We can simply build FSM with 689,250,224,704  (52! / 45! + ... + 52! /51!) states, that accepts all 7-elements words from 52-elements alphabet. But it weights 70 TB - that is too much for average hardware...


...but we can evaluate ranks and suits separately! We can create two FSM. The first one will accept 7-elements words from 13-element alphabet (card ranks) and the second one will accept 7-elements words from 4-element alphabet (card suits). It will lead us to much smaller transition tables.


After some optimizations I managed to build "tiny" FSMs that solves 7-cards hand evaluation problem. Now transition tables have only 1.2 MB!


The complete implementation (Java library licensed on GPL v3) can be downloaded from Foldem. I was able to evaluate about 4,500,000 7-cards hands per second (test was performed on the Celeron M 1.6 GHz CPU with Sun JDK 1.6 installed).

3 comments:

  1. Hi, I was wandering if its possible to figure out the cards that made the HandRank?

    i.e.
    Jc,5d,Qc,8s,Th,Ah,Qh
    returns a HandRank with id=3906 and type=PAIR
    how can I figure out the 2XQ

    Regards,
    Gal

    ReplyDelete
  2. Their anteroom gives a streamlined route, finding wanted amusements in only 2-3 mouse clicks.qqpokeronline

    ReplyDelete
  3. There is a precedent for online gambling,jetwin gambling site as a result there is no way to say that online gambling is legal, illegal or none of the above.

    ReplyDelete