File Exchange Pick of the Week

Our best user submissions

Poker Analyzer

Idin's pick for this week is Texas Hold'Em Poker Analyzer by Tim Farajian.

I have always been fascinated by games of chance. As an undergrad, I took some courses in probability and statistics. The more I learned about theory of probability, my fascination with card games in particular grew. Blackjack is my favorite casino game because the rules are very simple, and it can be analyzed through pure statistics (unlike poker where other players' actions are a significant part of the game).

For this week, I wanted to find a nice example of a card game in MATLAB, preferably one with some automated simulation built-in. I started with blackjack. Cleve Moler's Blackjack game is an example of an elegant MATLAB program, and how blackjack strategy can be implemented using simple matrices in MATLAB. He has an article on the subject here. But the simulation is not automated. Michael Iori's Blackjack came close, but wasn't as feature-rich as my eventual pick.

I finally went to poker, and came across Tim Farajian's Texas Hold'Em Poker Analyzer. This is an elaborate app with nice graphics that allows a user to simulate different scenarios in a Texas Hold'Em game. The interface is very simple and intuitive. Best of all, it automatically simulates as many hands as I would like, and displays winning probabilities or expected returns. No longer do I have to wonder if 8-10 suited is better than a pair of 3s; I can simply simulate and find out (slight edge goes to 8-10 suited, as seen below!).

Tim's example is useful on multiple fronts other than answering my poker questions! It's a nice example of MATLAB apps; he uses simple commands to draw the board and cards. He also implements the game itself efficiently (it's not trivial to deal out cards, or to analyze poker hands and rank them!). The program simulates thousands of hands in mere seconds. I also like its potential to serve as a blueprint for simulators of other games (e.g., blackjack!). A combination of Tim's graphics with Cleve Moler's blackjack could yield a nice blackjack analyzer. There are also some possibilities for improvements of the poker game, such as allowing a range of hands for a given player rather than specific cards (in a real poker game, you might know that a player has a strong hand, but not know his exact cards).

As always, your thoughts and comments here are greatly appreciated.

Published with MATLAB® R2013b

  • print
  • send email


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.