# Trying to express NL betting rules formally, did I miss anything?

I'm writing a poker app and need to implement the betting logic for the no-limit games. The basic rules behind min-raise/reopen have been discussed here before and I'm trying to express them (semi-) formally like this:

1. When it's a player's turn to act, there is a current bet CB and a previous raise PR. Also, there is a player OP who opened the betting round.

2. Pre-flop, CB and PR are both initially equal to the Big Blind, and the player sitting in the Big Blind is the OP.

3. Post-flop, CB and PR are intially 0 and the player first to act is the OP.

4. Checks, calls, and folds do not change CB, PR, or OP.

5. To raise, a player must make the new bet at least CB+PR, or at least the Big Blind (whichever is greater).

6. When a player raises, CB and PR get updated accordingly: CB now becomes the new bet, PR the difference to the previous bet (PR = CB_new - CB_old). Also, this player becomes the new OP (exception see next point).

7. If a player doesn't have enough chips to make a full-raise, but still more than needed for just a call, they can do an all-in raise. In this case, there now is a new CB. Also, PR get reduced by CB_new - CB_old, i.e. the min raise amount remains unchanged. The OP remains unchanged (some casinos/home games differ, but let's assume a full raise is required to reopen).

8. A betting round is completed when the action is back on the OP. Two exceptions:

• pre-flop, if that player sits in the Big Blind, and CB still equals the Big Blind ("option" for Big Blind in an unraised pot).

• at least one player at the table made an all-in raise according to (7) which didn't reopen, but there are players on the table which didn't have a chance to act yet after the all-in raise. In this case, the action continues until all these players have acted, too, but they do not have the option to raise (only call or fold).

Does all this correctly reflect the poker betting rules in no-limit games? Did I miss anything?

-
+1 Nice question. It's pretty complicated to implement something like this, but with patience it can be done. Don't forget the insane situations when 4 - 5 players go all-in, many sidepots will be made... Also, at number 8 second exception: "they do not have the option to raise". Why not ? They can keep raising and raising each other. A sidepot is made in this situation... I'll read it and re-read it and re-read it, to see if you missed something. At first glance, it's pretty complete... – Radu Murzea Dec 9 '12 at 8:56
Thanks for your feedback! Regarding "they do not have the option to raise" - maybe I'm wrong, but I thought those are the rules. Example: post-flop, three players. A bets 100. B raises all-in to 130 (doesn't reopen - so A is still the OP). C calls 130. Now the action is back on the OP (A), so the betting would normally be completed. But since there was a non-reopening all-in raise by B, some players might still have to call the all-in raise. In this case, A still needs to put in 30 more chips to call the all-in, but can't re-raise anymore. - Correct? – Max Dec 9 '12 at 21:53
You might be right. However, I'm not sure. Let's see what other people say, I'm curious. – Radu Murzea Dec 10 '12 at 9:39
Ok, let's wait for more comments. – Max Dec 11 '12 at 0:27
Hi Max. I played a live tournament the other day when this exact thing happened. No one was certain so the official came to the table and explained. If the person going all-in doesn't have enough for a legitimate raise, then those who have already made an action (e.g. they called the blinds before the all-in) can only call the all-in. They cannot re-raise. However, If someone hasn't made an action yet (say person to the left of the all-in), it is then ok for them to raise, and others may then re-raise. – Mew Dec 11 '12 at 2:07