fix/casino-holdem-deal-around-broke
The most ordinary thing that happens in a home game: somebody stacks off, and they
don't buy back in that second. The table dealt them in anyway, and the result was a
hand nobody could finish.
Three players, two of them busted:
bar before dealing:
"Pot $0 | 3 players | All-in - running out the board (3 players)
| Cal posts $1, Ann posts $2 | Post blinds & deal"
after dealing:
Cal posted nothing -- no chips to post with
Ann posted $2 and was asked to check or bet against her own money
liveSeats 3, isStreetComplete false, isHandOver false
Every line of that is wrong. It announced a board being run out over a felt with no
cards on it, promised a small blind from a seat that couldn't post one, took it from
nobody, and then sat on a hand with no way forward.
So a seat with no chips and nothing in the pot is dealt around. Their seat, name and
buy-in record are untouched -- sat out, not folded, because they didn't muck anything
-- and adding chips puts them straight back in the next hand.
four players, Ben busted, button on Ann:
"3 players | Cal posts $1, Dee posts $2
| Ben has no chips - sitting out this hand. | Post blinds & deal"
-> Ben inHand false, folded false; blinds exactly as promised; Ann to act
Said before it happens, for the same reason the button move is: a dealer shouldn't
find out from the felt. And the preview computes it on a view of the table rather
than by changing it, so the promise and the deal ask the same question -- the fault
these two lines exist to prevent.
When it can't be dealt at all, it says who has to buy in rather than pretending it's
a seating problem:
"Only Ann has chips - Ben and Cal need to buy in."
"Nobody at the table has chips left. Add a buy-in to deal."
Two smaller things fall out. The run-out banner is now gated on the betting actually
being open -- before the deal, a table of busted players is indistinguishable from a
table of all-ins to that test. And the bar's player count reads the table as it will
be dealt, so someone waiting on a rebuy isn't announced as one of the players.
Not the same as all-in, and the code says so: an all-in player has money riding on
the hand. A seat with no stack recorded isn't broke either -- those fall back to the
table's starting stack.
13 tests (198 total), and 5 of them fail with the sit-out and the run-out guard taken
back out.
Driven through the UI at seven viewports in both states: layout and contrast clean
everywhere but the landscape phone already known from #63, and no console errors.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015bnp7xKUPFFSpwkYNFaPgb
Description
No description provided
142 MiB
Languages
JavaScript
68.4%
CSS
14.1%
C#
8%
HTML
4.5%
C++
4.4%
Other
0.5%