File Exchange

## Texas Holdem Win Probabilities

version 1.0.0.0 (5.3 KB) by
Calculates the probability of each player winning a round of Texas Holdem

Updated 07 May 2012

The CardAnalyze function estimates the probability of each player at a table of Texas Holdem winning the round.

Variable inputs are accepted for number of players, player's cards, cards on the table, and number of Monte Carlo iterations to use in estimating probabilities.

The function is able to operate at 3 levels of information

Standard:
Only one player's cards are known

Perfect:
All players' cards are known

Collusion:
Some of the players' cards are known, some are not.

A 1.7ghz dual core processor is able to calculate 10,000 iterations for 6 players in under 1 second.

Starting a matlab pool will yield a notable speed increase
'matlabpool local'

If speed is still a concern, over half the computational time is spent on the loop call of 'randpermut'. This would be an area to improve.

The original purpose of the function was to develop strategies for identifying player collusion via machine learning.

### Cite As

Oliver Rice (2020). Texas Holdem Win Probabilities (https://www.mathworks.com/matlabcentral/fileexchange/36561-texas-holdem-win-probabilities), MATLAB Central File Exchange. Retrieved .

Thomas

Great tool!

alex

i found out that the actual probabilities are shown when all cards,flop turn river are in the table.
is it normal? shouldnt it be better to show the actual probabilities an any stage of the program?

alex

Hello Oliver!
i find this a very very nice job, however i i have an issue here:

CardAnalyze([14.1;13.1],[12.1,11.1,10.1],6,15000)

that means i have a flush royal on the flop,however the probalities i take are these:
ans =

0.9136
0.0185
0.0176
0.0172
0.0162
0.0169

but of my course my probality should be 1
any idea why this happens?

Daniel

Hi Oliver,

I have the same problem as described below. When running the process the following error appears:
??? Error: File: CardAnalyze.m Line: 130 Column: 11
Expression or statement is incorrect--possibly unbalanced (, {, or [.

I think it is because of the expression [~,Loc] which is not allowed.

Danyo

Duy

Oliver Rice

Saurabh,
Okay, lets try this. The simplest inputs you can give are

CardAnalyze([],[],6,15000)

This is random cards for every player. It will return a list of 6 win probabilities (1 per player) that should all be equal to within half a percent.

It sounds like you will be running using 'standard' information. So lets now try adding 2 cards in your hand and estimating the probability of winning.

CardAnalyze([2.1;2.3],[],6,15000)

The above will return the probability of you winning with pocket 2s pre-flop.

And now finally, when the flop, turn and river go on the board you can add them into the 'table' parameter like so.

CardAnalyze([2.1;2.3],[4.2,11.1,12.3],6,15000)

So now it is estimating again with a 4 of suit 2, a jack of suit 1 and a 12 of suit 3 on the table. The choice of which suit equals which decimal is up to you, just keep it consistant. Also, as people fold, you can adjust the 6 to represent the number of players remaining in the hand.

Let me know if you have any trouble.
Oliver

saurabh korgaonkar

oliver
thanks actually am also new to matlab file-exchange.
I wanted to try out your program against texas hold'em in Facebook.
currently i just played your demo program and had the following error
Can you give me some set of sample values just so i know the working of the program if i am doing it wrong

Oliver Rice

Saurabh,

I am not able to recreate your error. Please list the inputs you are using and I'll do my best to troubleshoot for you.

Best,
Oliver

saurabh korgaonkar

??? Error: File: CardAnalyze.m Line: 130 Column: 11
Expression or statement is incorrect--possibly unbalanced (, {, or [.

Error in ==> DemoCardAnalyze at 31
WinProb = CardAnalyze(Hand,Table,nPlayers,nIter);

##### MATLAB Release Compatibility
Created with R2011b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux