Two Plus Two Older Archives  

Go Back   Two Plus Two Older Archives > General Gambling > Probability
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-27-2003, 12:16 AM
jhaluska jhaluska is offline
Junior Member
 
Join Date: Jul 2003
Posts: 2
Default Monte Carlo vs Possible Equation?

In Hold`em, I'm trying to calculate the preflop odds of any hand beating another single hand. For example, say I have the hand 7 [img]/images/graemlins/diamond.gif[/img], 8 [img]/images/graemlins/spade.gif[/img] and I want to know the chance of beating K [img]/images/graemlins/spade.gif[/img], 3 [img]/images/graemlins/club.gif[/img]. Currently I'm trying millions of monte carlo simulations, but I was wondering if there was a formula I could use to compute it exactly?
Reply With Quote
  #2  
Old 07-27-2003, 05:58 AM
FastCards FastCards is offline
Junior Member
 
Join Date: Oct 2002
Location: Scotland
Posts: 26
Default Re: Monte Carlo vs Possible Equation?

There are 48 cards left. To get an exact answer you need to deal every possible flop combination and evaluate the two hands with each flop.

The number of flops is (48*47*46*45*44)/(5*4*3*2*1)
=1,712,304

I haven't come across a formula to calculate the exact answer without dealing all the flops. If such a formula exists I would think it would be rather complicated if it was designed to deal with any heads-up situation (as opposed to just 7h8s v Ks3c). Please correct me if I am wrong about this.

One (rough) way to deal all the flops programmatically:

1. Use an array of cards numbered 1 to 52.
2. Give each card a number, e.g. As=1, Ks=2....2h=52 etc
3. Take the players' cards out of the array leaving 48 cards
4. With the remaining 48 cards, use nested loops to get every possible combination.
5. Within the loops evaluate each hand with each flop and tally the results.

e.g.
for a=1 to 48 do
for b=a+1 to 48 do
for c=b+1 to 48 do
for d=c+1 to 48 do
for e=d+1 to 48 do
EvaluateFlop(Crd[a],Crd[b],Crd[c],Crd[d],Crd[e])

The values for a,b,c,d,e generated by the loop will be

1,2,3,4,5
1,2,3,4,6
1,2,3,4,7
....
2,3,4,5,6
2,3,4,5,7
...
...
44,45,46,47,48.

This gives you every possible combination. With a bit of thought you can extend this to allow for more than 2 players and/or 1 or more board cards.

I'm pretty sure that there are examples of this type of thing in the public domain.

Regards
Fast Cards
Reply With Quote
  #3  
Old 07-27-2003, 09:30 AM
jhaluska jhaluska is offline
Junior Member
 
Join Date: Jul 2003
Posts: 2
Default Re: Monte Carlo vs Possible Equation?

Actually my program already has the card numbering and I considered doing exactly that. Except I miscalculated how long it would take.

[ QUOTE ]
We took the data the Pokalyzer can generate from the simple operation above and ran every hand against every other hand which required over seven billion hand evaluations and took us two weeks.

[/ QUOTE ]

Sounds like you have some experience with the problem. [img]/images/graemlins/smile.gif[/img]
Reply With Quote
  #4  
Old 07-27-2003, 11:27 AM
FastCards FastCards is offline
Junior Member
 
Join Date: Oct 2002
Location: Scotland
Posts: 26
Default Re: Monte Carlo vs Possible Equation?

To deal every heads-up combination with every flop...

There are 169 starting hands (using Spades if suited, Spades and hearts if offsuit. The results are identical for other suit combinations).

Each of the 169 hands can play against 1225 other starting hands.

169*1225 = 207,025 match-ups.

With 48 cards left there are 1,712,304 flop combinations.

207,025 8 1,712,304 = 354,489,735,600

You need to evaluate both hands so double that figure to get

708,979,471,200 (just over 700 billion)

So it is 700bil hands, not 7bil. Processing took just over a week. The key is obviously to get your hand evaluation function fine tuned.

From a programming perspective it was an interesting challenge....
Reply With Quote
  #5  
Old 07-27-2003, 11:53 AM
droidboy droidboy is offline
Member
 
Join Date: Sep 2002
Location: oakland
Posts: 73
Default Re: Monte Carlo vs Possible Equation?



[ QUOTE ]
We took the data the Pokalyzer can generate from the simple operation above and ran every hand against every other hand which required over seven billion hand evaluations and took us two weeks.

[/ QUOTE ]

Sounds like you have some experience with the problem. [img]/images/graemlins/smile.gif[/img]

[/ QUOTE ]

He probably does, but it shouldn't take two weeks if you are clever.

Try PokerStove if you are looking for software that is an order of magnitude faster.
Reply With Quote
  #6  
Old 07-27-2003, 11:59 AM
droidboy droidboy is offline
Member
 
Join Date: Sep 2002
Location: oakland
Posts: 73
Default Re: Monte Carlo vs Possible Equation?

[ QUOTE ]
To deal every heads-up combination with every flop...

Each of the 169 hands can play against 1225 other starting hands.

169*1225 = 207,025 match-ups.

So it is 700bil hands, not 7bil. Processing took just over a week.

From a programming perspective it was an interesting challenge....

[/ QUOTE ]

It was an interesting challenge. It took me a few months to get my hand evaluator ramped up to speed. But once it was done, it took two hours to calculate all heads-up match-ups, not one week.
Reply With Quote
  #7  
Old 07-27-2003, 01:57 PM
FastCards FastCards is offline
Junior Member
 
Join Date: Oct 2002
Location: Scotland
Posts: 26
Default Re: Monte Carlo vs Possible Equation?

Congratulations to you for achieving such fast code.

In our scenario, speed was not important because we used the results from the 700bil hands to build a data table showing the results of all heads-up combinations for all possible flops. The data table is supplied with the software mercifully preventing the user for sitting for 8 days twiddling their thumbs.

Regards
Fast Cards
Reply With Quote
  #8  
Old 07-27-2003, 06:23 PM
droidboy droidboy is offline
Member
 
Join Date: Sep 2002
Location: oakland
Posts: 73
Default Re: Monte Carlo vs Possible Equation?

[ QUOTE ]
Congratulations to you for achieving such fast code.

In our scenario, speed was not important because we used the results from the 700bil hands to build a data table showing the results of all heads-up combinations for all possible flops. The data table is supplied with the software mercifully preventing the user for sitting for 8 days twiddling their thumbs.

Regards
Fast Cards

[/ QUOTE ]

I understand the amount of work that it takes to get all that data. And I certainly agree that solving that kind of problem is interesting. There are a lot of interesting things you can ask about poker, and equities. Coming up with specific answers to various scenarios is especially important when those sencarios come up regularly. Using precomputed solutions in these cases is exactly what you want to do.

But there are so many possible permutations on the problem that having a fast general solution is good as well. For example: how does AA fare versus KK when an ace has been exposed by a careless dealer? What about KK versus an opponent that caps preflop with AA/KK or AK?
Reply With Quote
  #9  
Old 07-27-2003, 09:19 PM
FastCards FastCards is offline
Junior Member
 
Join Date: Oct 2002
Location: Scotland
Posts: 26
Default Re: Monte Carlo vs Possible Equation?

Absolutely, a fast soluton is a pre-requisite.

The software uses the pre-compiled data files for the Heads-up listings only. You can also setup between 1 and 10 hands and (optional) board cards. In this scenario, every board combination is dealt and tabulated on the spot. Heads up with no flop (1,712,304 board combos) takes about 2 seconds (my first attempt was 24 seconds...). As well as the overall win/split/lose numbers it also records how many times each player hits a specific hand (flush, straight etc) and also how many times they win with each specific hand.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:52 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.