Skip to content

fix(ai): the bots checked the flop round multiway, and nothing measured it - #98

Merged
will-lamerton merged 1 commit into
mainfrom
fix/postflop-multiway-betting
Aug 29, 2026
Merged

fix(ai): the bots checked the flop round multiway, and nothing measured it#98
will-lamerton merged 1 commit into
mainfrom
fix/postflop-multiway-betting

Conversation

@pip-robot

@pip-robot pip-robot Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

pip-web #2 said the bots do not play like people. Session 24 measured the preflop game and found it was right, twice over. Nothing had ever measured the postflop game, and every band test in tests/ai.test.ts stops at the flop being dealt. So I measured it.

What was wrong

Every postflop gate in decideAction is an absolute equity number, and all four were written for a heads-up pot:

lead an unbet pot   equity > 0.62
value-raise         equity > 0.78
thin raise          equity > 0.60
bluff ceiling       equity < 0.40

An equity point is not the same size against three opponents as against one. Heads-up, 0.62 is a decent made hand. Four-handed it is close to the nuts, so multiway the gates are simply unreachable and the AI checks the pot round. This is the identical defect session 24 fixed preflop, one street later: an absolute threshold that the size of the field makes unpayable.

Measured on a loose profile, 80 six-handed hands, counting every postflop decision where the pot was checked to the AI:

opponents live before after sample
1 21% 19% n=130 / 170
2 7% 16% n=280 / 198
3 7% 23% n=82 / 40

And on the shipped venue profiles, 60 hands each:

venue leads an unbet pot by field size, before after
Friends' Garage 10.8% -> 13.9% 14% / 8% / 4% 14% / 12% / 19%
The Card Room 23.6% -> 23.9% postflop is ~all heads-up there unchanged
The Main Event 30.3% -> 29.9% postflop is ~all heads-up there unchanged

The loose tables are the ones that go multiway, and they are the ones a beginner meets first. Friends' Garage sees a flop in 85% of hands with 2.5 players still in it. The Main Event sees one in 47% of hands, almost always heads-up. So the defect was concentrated exactly where a new player would be sitting.

The fix, and the reason it can ship without a playtest of 29 tables

The gates are now quoted as a multiple of a fair share of the pot, 1 / (opponents + 1), which is what "ahead of this field" actually means.

Heads-up a fair share is exactly 0.5, so every multiple reproduces the absolute it replaced: 0.5 x 1.24 = 0.62, x 1.56 = 0.78, x 1.2 = 0.6, x 0.8 = 0.4. No heads-up pot plays differently. Only multiway spots move, which is where the defect was. A test pins that identity, so moving one of those multiples without realising it changes every table is now a failing build rather than a surprise.

The bluff ceiling was wrong in the other direction and gets the same treatment: four-handed, "under 0.40" is almost every holding, so the AI fired its full bluff frequency with hands that were good for the pot size and called it a bluff.

Does it make the beginner table harder? No, it appears to make it beatable

This is the result I did not expect and the one worth your attention. pnpm sim garage --n 60 --hero beginner:

win % fair % EV/entry
before 32% 33% -5
after (seed 4) 42% 33% +25
after (seed 11) 47% 33% +40

config/venues.ts says Friends' Garage is "loose-passive on purpose: calls too much, rarely bluffs. A beginner beats it." Before this change a beginner did not beat it. They sat a point below a fair share of the field. Checking every marginal hand down lets the bots realise their equity for free, which is worth more than the chips they were not putting in.

Read the numbers with the caveat they deserve: n=60 tournaments, so the standard error on a win rate near 0.4 is about 6 points and a single 10-point gap is not conclusive on its own. What it does rule out is the failure I was actually checking for, which is the table becoming unbeatable. It went the other way.

The gate

pnpm test:all green, 505 tests, pnpm build clean. Two new tests:

  • the band test, which fails on the pre-fix code with the exact diagnostic 2 opponents: 7% of unbet pots led (n=280), against 21% heads-up. Verified by stashing the fix and running it. Written as a collected list compared against [] rather than a loop of assertions, and it asserts its own sample size first, because a rate over a handful of spots is not a rate.
  • the identity test, which pins the four heads-up equivalences the safety argument above rests on.

What the gate did NOT cover

  • Nobody has played this. There is no browser and no device in this runner. The gate proves the AI bets multiway pots at a rate more like poker; it cannot tell you whether the table now feels better or whether the bots read as spewy. That is the half only you can do, and the beginner table is the one to sit at.
  • Only three of 29 venues were measured directly, and only garage was simulated for difficulty. The other 26 inherit the argument, not a measurement. The heads-up no-op property is what makes that reasonable, since 8 of the 10 ladder rungs play postflop almost entirely heads-up and are therefore untouched by construction.
  • The remaining passivity is not fixed and is not a regression: the AI still cannot bet an equity band from 0.40 to 0.62, which is 19.2% of heads-up flops, and that is where every draw and every marginal made hand lives. Closing it changes every table on the ladder, so it is filed as technology#79 with the measurement and it wants a playtest first.

Also in here, one comment: WithTheMembership's docblock said no paid kind was registered so nothing rendered it. That stopped being true in v1.16.0 and the sentence is serving on playpip.io today (technology#75).

…ed it

Every postflop gate in the policy was an absolute equity number written for a
heads-up pot. An equity point is not the same size against three opponents as
against one, so multiway the gates were unreachable: measured on a loose profile
the AI led an unbet pot 21% of the time heads-up and 7% against two or three.

Quoted as a multiple of a fair share of the pot instead. Heads-up a fair share
is exactly 0.5, so every multiple reproduces the absolute it replaced and no
heads-up pot plays differently. Multiway leading goes to 16% and 23%.

Also corrects the WithTheMembership docblock, which said nothing rendered it
(technology#75).
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying pip-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: 96c41a0
Status: ✅  Deploy successful!
Preview URL: https://79c84dda.pip-web-9oj.pages.dev
Branch Preview URL: https://fix-postflop-multiway-bettin.pip-web-9oj.pages.dev

View logs

@pip-robot

pip-robot Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Third sim seed finished after I opened this, and it firms the beatability number up.

pnpm sim garage --n 60 --hero beginner, after the change: 42% (seed 4), 47% (seed 11), 45% (seed 17). Pooled that is 44.7% over 180 tournaments against a fair share of 33%, and the standard error drops to about 3.7 points. The before-number is still a single run of 60 (32%, SE ~6), so the gap is roughly 1.8 sigma: consistent across three independent seeds and still not a 95% claim.

What it is good enough for is the thing I was actually checking, which is that making the bots bet multiway did not make the beginner table harder. It did not. It still needs you to sit at it, because none of this says whether the table is more fun.

@will-lamerton
will-lamerton merged commit f002363 into main Aug 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant