Sunday, August 26, 2012

Poker 2: Hand Evaluator

I am no poker player, but I know the basic rules (Texas Hold'em), having casually played one to one games against the computer on a friend's iPad. In the process I got interested in how the computer evaluates the strength of the hands as in quite a few cases an exhaustive enumeration of all possibilities is very long / impossible and in almost all cases a hand evaluator must be really fast to have any practical value...

So, perusing the internet, I ran into SpecialK's blog and was instantly admirative. His algorithm is so elegant, so simple, and therefore lightning fast, that the next time I blinked, I saw the allegory of speed and elegance combined... The glorious vision was something like this.

And it is so improbably fitting computers architecture (specifically 32 bit integers) that there is almost a divine touch to it...

Ok, after the emotion following the discovery, here is some information.

Thursday, August 23, 2012

Poker 1: Probabilities

By Poker, I mean its most popular variant: Texas Hold'em.

Below is the table enumerating the frequency of 5 card poker hands, sorted in the 9 hand types, assuming cards are randomly drawn from a 52 card deck (obviously without replacement).

The definition of the 9 hand types and the details of the relatively simple computations leading to the results in the table are very well described in Wikipedia.