tux21b.org - Web Playground of Christoph Hack

personal web playground

Calculating Poker Odds

written by Christoph Hack, on Feb 9, 2010 1:17:00 AM.

After hearing from Anna Kournikova, which is in fact a technical term in Poker with the meaning “Ace King - looks really good, but rarely wins”, I was asking myself about the exact odds of those two cards. So I started to write a small program called PokerBuddy to answer questions like these.

The first approach was to try out every possible distribution of cards and so I wrote an algorithm to list all combinations of picking 2 cards out of 52 (no repetitions, order doesn’t matter). But then, when I continued to pick the 5 board cards out of the remaining 50 cards, I was surprised how big the number of possibilities is. Even a heads-up game with only two players yields extremely high numbers, which can neither be computed in realtime nor can be saved in lookup tables.

So I started to think about the problem more deeply and came to the conclusion that I probably have to use some kind of sampling method (like Monte Carlo sampling) which I have already used in a preceding ray tracing project. In short, this method works by taking a high number of random samples to compute the result.

By searching the web for “poker” and “monte carlo” I quickly stumbled upon a library called poker-eval which even offers python bindings. I switched from C++ back to my favourite programming language Python and created a GUI with Glade. PokerBuddy was born:

PokerBuddy

You can enter as many cards you want and adjust the number of players to fit your needs. PokerBuddy will then calculate instantly the total odds for the game using the available information. Additionally it can compute the break even point under which bets are profitable. Later version of the tool might even include some game theory (e.g. by suggesting folds and raises) but therefore I would have to re-read the book A Theory of Poker (which I can highly recommend).

Those who are already interested in the small project can find the sources under the following address: http://bitbucket.org/tux21b/snippets/src/tip/pokerbuddy/ (GPL)

Comments

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

  • Comment waiting for approval

Leave a Reply

(not published)