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.
Tim, thank you for this tool. I learned a lot both about poker and Matlab. In the help text you mention having a much faster algorithm. Could you please share it? If it's not clean at least privately?
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.....
Really nice and compact code. Regular m-file, no problem if you have a Matlab running.
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.
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.
could not open M file. how do i get this thing to work?
ditto comments one ..couldn't open M file
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.
This is a great idea. And easy to use.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.