← The Backroom: all chapters

BOOK 2 · PART II · BUILD · STUDENT CHAPTER

Smarter Rules

Your first robot had six lines. Make it smarter and it grows: pot odds, then position, then a score for every starting hand. Each fix covers one more case, and there's always another case. Count the lines as you go. That count is the lesson.

By Kevin Swinson, with Claudette · Student chapter · Robot Builder · Pot odds · Position

Three robots on one page

Below the edit box, Robot Builder keeps three examples to learn from: Simple, Medium and Complex. Each one is a complete, working robot; copy it into the box and it becomes yours. They're also a staircase. Each step up adds one idea a poker player would recognize, and the code grows to hold it.

EXAMPLETHE IDEA IT ADDSROUGHLY HOW LONG
SimplePair or better: raise. Anything else: fold.6 lines
MediumThe price matters. Different bars on the flop, turn and river. Call wider when it's cheap, tighter when it's steep, and never fold when it's free.About 30 lines
ComplexA score for every starting hand, plus position: loosen up in late seats, tighten up in early ones.About 70 lines

Medium: the price matters

The Medium robot's big idea is one line of arithmetic. Robot Builder calls it your break-even price:

req = to_call / (pot + to_call)

In words: what share of the final pot are you being asked to put in? If the pot holds 30 chips and it costs you 10 to call, you're paying 10 to win 40, a quarter. If your hand wins more often than that, calling pays over time. That's pot odds, and it's the reason "Cheap to see a flop" and "The price was right" are in your hand journal.

The Medium robot uses the price to nudge its bars. It keeps one table of bars for each street:

STREET_PLAY = {
    "flop":  (PAIR,     TWO_PAIR),
    "turn":  (PAIR,     TRIPS),
    "river": (TWO_PAIR, TRIPS),
}

Read each line as "to call, I need at least this; to raise, I need at least that." On the flop it calls with a pair and raises with two pair; by the river it wants two pair just to call. Then the price moves the calling bar: cheap (under a quarter of the pot) loosens it a step, steep (over 40%) tightens it, and free means never fold.

Complex: every hand gets a score, every seat gets a say

The Complex robot adds two ideas. First, before the flop it scores its two cards instead of waiting for a pair. Pairs score highest. Otherwise it adds up the two cards' ranks, then adds a little for cards of the same suit, a little for cards next to each other, and a little more for an ace. It raises above one score, calls above another, and folds the rest.

Second, it reads its obs.position. In a late seat it loosens up a step; in an early seat it tightens. That's the "Good position" circle in your journal, written as a rule.

Put those together with the Medium robot's pot odds and you have a robot with three or four numbers to tune: when to raise, when to call, how far to step for price and position. It plays noticeably better than six lines. It's also about seventy lines long.

Count the cases

Here's the honest part. Every idea above fixed a weakness, and every fix is a new case for someone to think of, write and test. And the Complex robot still can't do things any beginner does:

You could add each of those. Draws are maybe twenty more lines. A bluff needs a rule for when, and how often, and against whom. A read needs a memory the robot doesn't have. Every addition opens two more questions. That's not a flaw in your programming. It's the nature of rules: they cover the cases someone thought of, and nothing else.

At the table

  1. Copy the Medium example into the box and save it. Run a Robot War with it.
    Done when: you have its game number.
  2. Do the same with the Complex example.
    Done when: you have a second game number.
  3. In Game Review, find one hand where each robot's price rule or position rule changed its move. Write the hand number and what the rule did.
    Done when: you've found one hand for each.
  4. Change one number in the Complex robot (say PRE_CALL, the score it needs to call before the flop) and run it again. Write down what you changed and what happened.
    Done when: you've run the changed robot and compared.

Try it yourself first

  1. The pot is 60 chips. It costs you 20 to call. What's your break-even price?
  2. Your hand journal says "Drawing to something" on a hand you called. Could the Complex robot have made that call for the same reason?
  3. Name one reason from your journal's "What no checkbox could say" box. How many lines would it take to write?

ANSWER KEY

  1. 25%. 20 ÷ (60 + 20) = 20 ÷ 80 = 0.25. If your hand wins more than a quarter of the time, calling pays over time. If you got 33%, you divided by the pot alone; your own call is part of the pot you'd win.
  2. No. The Complex robot reads made hands, not draws. It might call because the price was cheap, but never because it was drawing.
  3. There's no right number. Some are a line or two ("big bets scare me" is mostly about bet size, which a robot can see). Others can't be written at all without a memory ("he's been bluffing all night"). Keep your answer for the next chapter.

Written by Kevin Swinson with Claudette, the pen name for Claude, the AI from Anthropic that helped build HoldemRobots.AI. Code and quoted notes are from the Robot Builder page on HoldemRobots.AI (October 29, 2026). Line counts are approximate. Diversion 19 is in the diversions record.