*** Texas Hold'em Pocket Analyzer ***

Quick Start
-----------
Left/right click on the hands on the table or on the deck on the right to add/remove hands to the game or to add/remove cards to a hand.

Click the Simulate button to start the simulation (at least two hands must be in game). 

"Win Percentage" shows the percentage of games each hand has won during the simulation.  "Expected Return" shows the expected amount of money returned from a $1 bet.



Introduction
------------

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.

Note that the analysis does not consider betting or folding.  Assume that everyone bets $1 before any card is dealt.  Then, after all cards are dealt, the winning hand(s) collects the pot.


Algorithm
---------

The program uses a Monte Carlo simulation, which simulates many games and displays the results of those games, rather than using the exahaustive search method, which calculates all possible outcomes.  The reason for this is that for most simulations, it could take years, even centuries, to perform the exhaustive search.  The Monte Carlo method used here usually converges to a useful value within seconds.

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.

In another application that was written with performance in mind, I was able to achieve performance that is over one hundred times faster.  This other application was used to generate charts giving the win ratio for all of the 169 possible pocket combinations you can be dealt versus up to 12 other players.  I will clean up this other code and post it to MATLAB Central at a later date.


Display of Results
----------------------

The GUI gives the choice of displaying the win percentage or the expected return.  The win percentage is simply the percentage of games that the hand will win.  A fraction of a win is given for a tie.  As in real poker, if, for example, three people tie to win a game, then the pot will be split three ways.  Therefore, in this analysis, a third of a win is given for a three way tie.

The expected return is simply the win percentage multiplied by the number of seats.  The expected return is generally a more statistically significant value than the win percentage.  It is an indicator of the amount of money you should expect to win from a $1 bet.

At the top of the GUI is displayed the number of games that have been simulated.


Interface
----------

On the left is displayed ten "seats".  Each seat may or may not be selected to be in the current game.  If the card is displayed as the same color as the table, then the seat is not selected to be in the game.  

To select a seat to enter a game, left-click on either of the cards.  This will display that seat's hand as "face down".  The selected card is indicated by having a thicker border than the other cards.

To unassign a seat from a game, right-click on either of its cards when the hand is displayed as "face down".

On the right is displayed all cards in a standard deck.  If you left-click on any deck card (that isn't already assigned to a hand) that card will be assigned to currently selected card on the left.

To unassign a card from a seat, right-click on that card.

To run the simulation, click the "Simulate" button.  This button now becomes the "Stop" button.

The "Deal" button will randomly deal cards into all seats that are currently in the game.  If no seats are currently in the game, the "Deal" button will assign all ten seats to the game, and then will randomly deal cards into all ten seats.

The "Clear" button will unassign all seats from the game.


Consider this
-------------

Consider a head-to-head matchup (two players) with A,K suited versus 2,2.  Simulating this, 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 matchup 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.

Enjoy it,

Tim Farajian 12/2004
tfarajia@mathworks.com

