I am trying to write a small, but complex, Texas Hold 'Em game in C++. I've come very close to the end. I'm at the part of determining winners, and payouts. Suffice it to say, I underestimated the complexity of poker.
At any rate, to finish my game, I need to understand a few things. First, observe the following hand starting chip stacks (ignoring forced bets for simplicity):
Player 1: 4k
Player 2: 6k
Player 3: 8k
Player 4: 10k
Say the hand gets to the showdown looking like this:
Player 1: all-in (for 4k)
Player 2: all-in (for 6k)
Player 3: folded after initially calling for 4k
Player 4: called 6k
Now, here is where it gets fuzzy: What would the primary pot look like? Since p3 folded, I am assuming it would be 3 * 4k, while the sidepot contested by p2 and p4 would be 2* 2k.
But what happens to the folded guy (p3)'s money? Is it added to the primary pot? Split equally between all pots? Returned?