4.3

4.3 | 10 ratings Rate this file 236 downloads (last 30 days) File Size: 8.88 KB File ID: #6710

Texas Hold'Em Poker Analyzer

by Tim Farajian

 

11 Jan 2005 (Updated 12 Jan 2005)

No BSD License  

Analyzes the win frequency and expected return of a hand in a poker game called Texas Hold'Em.

Download Now | Watch this File

File Information
Description

This graphical interface computes the winning frequency of any given hand in a poker game of Texas Hold'em. This is similar to the percentages they show on the poker games on TV.

Most poker analyzers require that you specify what cards your opponent is holding. Then, the program will determine your hand's chances of winning versus your opponent's specified hand.

An advantage of this Texas Hold'em analyzer is that it determines the win frequency of a hand without knowing what the opponent is holding. It will determine your hand's chances of winning versus any arbitrary hand your opponent(s) might hold. This is similar to the situation when you are sitting at a table in a real game.

Which pocket hand is better, A,K suited or 2,2? Consider a head-to-head match up (two players) with A,K suited versus 2,2. Simulating this with the analyzer, we find the win percentage to be about 50/50. However, which hand is stronger versus any arbitrary hand? We find that 2,2 versus any arbitrary hand remains about 50/50. However, A,K versus any arbitrary hand is better at about 66/34. Therefore, a head-to-head match up does not indicate how strong one hand is versus another arbitrary hand.

Now add another arbitrary hand to the game. We find this reduces the win percentage of the A,K suited to about 51%, but we find it increases the expected return from 1.33 to 1.5. Therefore, we see that although we'll win fewer hands, we expect to win more money.

The expected return of 2,2 versus another hand is about 1.0. The expected return versus three other hands decreases to about 0.88. However, using nine other hands increases it to about 1.18. Therefore, increasing the number of hands does not result in a monotonically increasing or decreasing expected return.

If you have an interest in looking at the code, note that this program originated as a programming exercise in vectorizing operation. Very few FOR-loops are used. Although there was a great benefit to vectorizing operations in versions prior to MATLAB 6.5 (R13), this is not the case in more recent versions. The JIT accelerator now speeds FOR-loops so that they are often as fast, if not faster, than vectorized operations. Therefore, this code is not as fast as it can be, and uses more memory than it needs to.

MATLAB release MATLAB 7 (R14)
Zip File Content  
Other Files PokerAnalyzer.m,
PokerHelp.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (12)
01 Apr 2005 Heinrich Badenhorst

This is a great idea. And easy to use.

09 Jun 2005 1 2

duzzzzz

09 Sep 2005 john W. deep

I have windows XP. I cannot open PokerAnalyzer.m. I have Adobe, version 7. Can you send me directions on how I might open this file? When trying to open the file using Adobe, I get a dialogue box that tells me it is not a supported file type or the file has been damaged when sent as an e-mail.

20 Sep 2005 Tony Thurston

ditto comments one ..couldn't open M file

21 Nov 2005 Brad B

could not open M file. how do i get this thing to work?

28 Nov 2005 Tim Reid

What is an m-file?
An m-file, or script file, is a simple text file where you can place Matlab commands. When the file is run, Matlab reads the commands and executes them exactly as it would if you had typed each command sequentially at the Matlab prompt. All m-file names must end with the extension '.m' (e.g. plot.m). If you create a new m-file with the same name as an existing m-file, Matlab will choose the one which appears first in the path order (help path for more information). To make life easier, choose a name for your m-file which doesn't already exist. To see if a filename.m exists, type help filename at the Matlab prompt.

Why use m-files?
For simple problems, entering your requests at the Matlab prompt is fast and efficient. However, as the number of commands increases or trial and error is done by changing certain variables or values, typing the commands over and over at the Matlab prompt becomes tedious. M-files will be helpful and almost necessary in these cases.

How to create, save or open an m-file?
If you are using PC or Mac:

To create an m-file, choose New from the File menu and select m-file. This procedure brings up a text editor window in which you can enter Matlab commands.
To save the m-file, simply go to the File menu and choose Save (remember to save it with the '.m' extension). To open an existing m-file, go to the File menu and choose Open .

If you are using Unix:

To create an m-file, use your favorite text editor (pico, nedit, vi, emacs, etc.) to create a file with .m extension (e.p. filename.m).

How to run the m-file?
After the m-file is saved with the name filename.m in the Matlab folder or directory, you can execute the commands in the m-file by simply typing filename at the Matlab prompt.

If you don't want to run the whole m-file, you can just copy the part of m-file that you want to run and paste it at the Matlab prompt.

18 Apr 2006 dr krimson  
29 Apr 2006 Adam C

Really excellent, just two improvements... Help button needs to be platform independent (most unix boxes don't have "notepad"). Monte Carlo simulation of winning percentage is fine, but actual concrete winning percentage would be nice too, I imagine that would be a little more difficult to code/figure out the math though.

30 Nov 2006 Jussi Makinen

Really nice and compact code. Regular m-file, no problem if you have a Matlab running.

25 Nov 2007 jim b

Very nice interface. If you really want to make a useful tool however, you absolutely need to be able to assign to your opponents a range of hands. For example, I'm playing against a tight player, I make a big raise with AKo; he
calls. I figure that he would have 77+, AK, AQs. What are my chances against this range?
You can figure it out from this simulation but you would have to run each possible holding and then do a weighted sum of the win percentages...e.g. he can have 77 twelve ways, AK six ways (since you already have one
of the aces and one of the kings), AQs three ways.....

22 Feb 2008 papi papas  
21 Nov 2008 Davide Ferraro  
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
statistics Tim Farajian 22 Oct 2008 07:39:28
probability Tim Farajian 22 Oct 2008 07:39:28
texas hold em Tim Farajian 22 Oct 2008 07:39:28
holdem poker Tim Farajian 22 Oct 2008 07:39:28
analyzer Tim Farajian 22 Oct 2008 07:39:28
cards Tim Farajian 22 Oct 2008 07:39:28
pocket Tim Farajian 22 Oct 2008 07:39:28
gambling Tim Farajian 22 Oct 2008 07:39:28
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com