# All-ins and folds: what happens to folded money?

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?

• If p3 put 4k into the pot, that's in the main pot: it's 4 x 4k. It has four players' money in it, even though only three of them are now eligible to win it. You are correct about pot 2: it contains 2k from p2 and 2k from p4, and only they can win it. Dec 10, 2015 at 17:01

## 1 Answer

In these types of all in situations, first identify the shortest stack that is all in--in this case 4k. The main pot will include up to that amount for each player that participated in the hand. If somebody puts in less than the shortest stack but ends up folding, that amount goes to the main pot. If anybody matches what the shortest all in stack put in, that amount goes to the main pot (so in this hand, all of the 4k that player3 put in goes to the main pot). And then for anybody who puts in more than what the shortest stack had, a portion of their total bet that's equal to the shortest stack goes to the main pot (so in this hand, for both player2 and player4: the first 4k of what they put in goes to the main pot).

There can be multiple side pots...imagine if everybody had gone all in for this hand. For each successive side pot, things work similarly except that the second side pot contains everything that is contributed BETWEEN the smallest all in's stack (4k here) and the next smallest all in stack (would be 6k here). Then you're left with whatever the last two players put in that's above and beyond the previous all in player's stack.

Hopefully that makes sense. To be clear for the example you gave, the main pot would be 16k and the side pot would be 4k.

• I think I get it. A 6k fold would've given 4k to the main pot, and 2k to the sidepot. Dec 10, 2015 at 6:27