Hand Pot calculation

For general discussion of the Poker Mavens software
Post Reply
p4s
Posts: 5
Joined: Mon Oct 21, 2013 9:29 am

Hand Pot calculation

Post by p4s »

I am trying to understand how PM calculates the total Pot. For example, I have these hands in my log file:

Code: Select all

PLAYER1 has the dealer button
PLAYER1 posts small blind 5
PLAYER2 posts big blind 10
** Hole Cards **
PLAYER1 calls 5
PLAYER2 raises to 30
PLAYER1 calls 20
** Flop ** 
PLAYER2 checks
PLAYER1 checks
** Turn ** 
PLAYER2 bets 10
PLAYER1 calls 10
** River ** 
PLAYER2 checks
PLAYER1 checks
** Pot Show Down **
PLAYER2 wins Pot (78) with a Straight
Rake (2)
Now my calculation would go as:

Code: Select all

Round0 = 5+10
Round1 = 5+30+20
Round2 = 10+10
Total  = 90
Pot = 78?!

Code: Select all

PLAYER1 has the dealer button
PLAYER1 posts small blind 5
PLAYER2 posts big blind 10
** Hole Cards **
PLAYER1 calls 5
PLAYER2 raises to 20
PLAYER1 calls 10
** Flop ** 
PLAYER2 bets 10
PLAYER1 calls 10
** Turn ** 
PLAYER2 checks
PLAYER1 checks
** River ** 
PLAYER2 bets 50
PLAYER1 calls 50
** Pot Show Down ** 
PLAYER1 wins Pot (156) with a Pair
Rake (4)
My calculation:

Code: Select all

Round0 = 5+10
Round1 = 5+20+10
Round2 = 10+10
Round3 = 50+50
Total  = 170
Pot = 156?!

Code: Select all

PLAYER2 has the dealer button
PLAYER0 posts small blind 5
PLAYER1 posts big blind 10
** Hole Cards **
PLAYER2 calls 10
PLAYER0 folds
PLAYER1 raises to 35
PLAYER2 calls 25
** Flop ** 
PLAYER1 bets 50
PLAYER2 raises to 100
PLAYER1 calls 50
** Turn ** 
PLAYER1 bets 250
PLAYER2 calls 250
** River ** 
PLAYER1 bets 500
PLAYER2 calls 500
** Pot Show Down ** 
PLAYER2 wins Pot (1725) with a Flush
Rake (50)
My calculation:

Code: Select all

Round0 = 5+10
Round1 = 10+35+25
Round2 = 50+100+50
Round3 = 250+250
Round4 = 500+500
Total  = 1785
Pot = 1725?!

----------------------------------

So as I can see Pot is always the actual sum minus Rake and minus 10 chips. Why 10? What's that for?

Another strange fact. When I import the log into PMRake I see that this program does calculate rake correctly - according to the proper sum (and without Rake subtracted). It doesn't seem to use Pot size as stated in the log file. Then why Pot size is there and why it's wrong?

Hope someone can give me an answer. Thanks in advance.
Kent Briggs
Site Admin
Posts: 5880
Joined: Wed Mar 19, 2008 8:47 pm

Re: Hand Pot calculation

Post by Kent Briggs »

p4s wrote:I am trying to understand how PM calculates the total Pot. For example, I have these hands in my log file:

Code: Select all

PLAYER1 posts small blind 5
PLAYER2 posts big blind 10
** Hole Cards **
PLAYER1 calls 5
PLAYER2 raises to 30
PLAYER1 calls 20
Now my calculation would go as:

Code: Select all

Round0 = 5+10
Round1 = 5+30+20
"raises to 30" is not +30 as you calculated. Player2 has 10 chips still in front of him from the BB that has not been scooped yet. So "raises to 30" adds 20 more chips.
p4s
Posts: 5
Joined: Mon Oct 21, 2013 9:29 am

Re: Hand Pot calculation

Post by p4s »

Thanks, that was fast. However, your point looks strange because of two things. Another hand example:

Code: Select all

PLAYER2 has the dealer button
PLAYER0 posts small blind 5
PLAYER1 posts big blind 10
** Hole Cards **
PLAYER2 raises to 20
PLAYER0 folds
PLAYER1 calls 10
** Flop ** 
PLAYER1 checks
PLAYER2 bets 10
PLAYER1 calls 10
** Turn ** 
PLAYER1 checks
PLAYER2 bets 10
PLAYER1 calls 10
** River ** 
PLAYER1 checks
PLAYER2 checks
** Pot Show Down ** 
PLAYER2 wins Pot (83) with Two Pair
Rake (2)
Calculation:

Code: Select all

Round0 = 5+10
Round1 = 20+10
Round2 = 10+10
Round3 = 10+10
Total  = 85
If I assume that raising keeps BB intact then why here Pot size is exactly the one I have calculated, just without Rake?

And another thing. If I import this log into PMRake is shows exactly the same number as if it was calculating just like me:

Code: Select all

PLAYER0 = 5 / 85 = 0.06 * 2 = 0.12
PLAYER1 = 40 / 85 = 0.94
PLAYER2 = 40 / 85 = 0.94
For the third hand in my first post the difference is even more clear: if I assume Pot size of 1725 like said in the log then:

Code: Select all

PLAYER0 = 50 (Rake) * (5 / 1725) = 2.58
PLAYER1 = 50 (Rake) * (890 / 1725) = 25.80
PLAYER2 = the same
If I add Rake (50) to Pot then:

Code: Select all

PLAYER0 = 50 (Rake) * (5 / 1775) = 0.14
PLAYER1 = 50 (Rake) * (890 / 1775) = 25.07
PLAYER2 = the same
However, if I take my own calculated 1785 Pot then:

Code: Select all

PLAYER0 = 50 (Rake) * (5 / 1785) = 0.14
PLAYER1 = 50 (Rake) * (890 / 1785) = 24.93
PLAYER2 = the same
Now if I see it in PMRake I see exactly the last calculation. How you can explain this?
Kent Briggs
Site Admin
Posts: 5880
Joined: Wed Mar 19, 2008 8:47 pm

Re: Hand Pot calculation

Post by Kent Briggs »

p4s wrote:If I assume that raising keeps BB intact then why here Pot size is exactly the one I have calculated, just without Rake?
Player2 was not in the blind so when he raises to 20 he is essentially calling the 10 chip blind and raising 10 more to a total of 20. The call is then 10 more for the BB player. That's 40 plus the 5 from the SB who folded for a total of 45.
And another thing. If I import this log into PMRake is shows exactly the same number as if it was calculating just like me:
I'm not sure what you asking. Rake is not calculated as a percentage. It is specified as x number of chips for every y chips in the pot and is subjected to a maximum z limit. This is calculated at the end of each betting round as the chips are scooped to the middle. The standalone Rake Stats utility does have a function to extrapolate rake per player but the poker server itself does not do that. It applies rake to the total scoop before adding them to the total amount displayed.
Kent Briggs
Site Admin
Posts: 5880
Joined: Wed Mar 19, 2008 8:47 pm

Re: Hand Pot calculation

Post by Kent Briggs »

p4s wrote:

Code: Select all

PLAYER2 has the dealer button
PLAYER0 posts small blind 5
PLAYER1 posts big blind 10
** Hole Cards **
PLAYER2 calls 10
PLAYER0 folds
PLAYER1 raises to 35
PLAYER2 calls 25
** Flop ** 
PLAYER1 bets 50
PLAYER2 raises to 100
PLAYER1 calls 50
** Turn ** 
PLAYER1 bets 250
PLAYER2 calls 250
** River ** 
PLAYER1 bets 500
PLAYER2 calls 500
** Pot Show Down ** 
PLAYER2 wins Pot (1725) with a Flush
Rake (50)
My calculation:

Code: Select all

Round0 = 5+10
Round1 = 10+35+25
Round2 = 50+100+50
Round3 = 250+250
Round4 = 500+500
Total  = 1785
Pot = 1725?!
Another mistake you are making is treating pre-hole cards and post-hole cards as separate betting rounds. They are the same round. There are 4 rounds max, not 5. In the example above, 75 chips were collected pre-flop, 200 on the flop, 500 on the turn, and 1000 on the river for a total of 1775. Minus the 50 rake = 1725 awarded to the winner.
p4s
Posts: 5
Joined: Mon Oct 21, 2013 9:29 am

Re: Hand Pot calculation

Post by p4s »

Hm, thank you. I'm trying to get this into my head and can't say I fully understand the logics.

Basically, what I need right now is to duplicate PMRake functionality. In particular, I can parse hand logs and extract pot size from them thus avoiding complex calculations that the server has already done. However, I need to get proportional rakes per each player (so that later I can calculate each agent's rakeback for his players). As far as I see there are lots of rules and different type of games; I'd love to avoid knowing this all. I have hand logs and need to get each player's share of rake, or at least exactly how much each player has contributed to the pot (with this I can calculate the share easily). Can you suggest any simple way of doing this?
p4s
Posts: 5
Joined: Mon Oct 21, 2013 9:29 am

Re: Hand Pot calculation

Post by p4s »

Now that I'm going over this I seem to have an algorithm. Can you correct me if I'm wrong somewhere? Maybe I'm missing another action type in regards to PM, etc.
  • Divide each hand into rounds: Hole, Flop, Turn, River - Hole having pre-Hole bets merged into one
  • For each round see player actions which can be:
  • fold - stop calculating player and keep his chips as he's left the game
  • bet - it occurs only once in each round so just set this amount and that round's start bet
  • call - add this sum to the player; round bet remains the same
  • check - "add 0"
  • raise - see what current round bet is and subtract it from the raise shown in the log
  • Now just sum individual players' bets for all rounds they were in to get their share of the pot (and rake)
Kent Briggs
Site Admin
Posts: 5880
Joined: Wed Mar 19, 2008 8:47 pm

Re: Hand Pot calculation

Post by Kent Briggs »

You're on the right track. The full list of actions you want to look for are:

posts big blind
posts small blind
posts small & big blind
checks
calls
bets
raises to
folds
wins
refunded

Maintain current and total values for each player. Add the current value to the total value at the end of each betting round and zero out the current value. These actions replace the current value: posts big blind, posts small blind, posts small & big blind, bets, and raises to. Adds to current value: call. Subtracts from current value: refunded. Does not modify current value: checks, folds, wins.
Kent Briggs
Site Admin
Posts: 5880
Joined: Wed Mar 19, 2008 8:47 pm

Re: Hand Pot calculation

Post by Kent Briggs »

p4s wrote:raise - see what current round bet is and subtract it from the raise shown in the log
Or just replace the player's current bet with the "raise to" amount recorded. No subtraction needed since the previous amount has not yet been scooped to the pot.
p4s
Posts: 5
Joined: Mon Oct 21, 2013 9:29 am

Re: Hand Pot calculation

Post by p4s »

I've got it now. About 250 lines of PHP code did the job - it seems so. At least I get 100% match when calculating pot size with my parser and comparing it to what the server has on the log file. I also get 100% match with PMRake results - which is unexpected because I don't fully understand how it's calculated. Funny things computers are :lol:

Anyway thanks for the help, Kent. Your support is wonderful, keep it up for future generations :)
Post Reply