Skip to content

feat(holdem): call out bad beats at showdown - #105

Merged
JonasFocus merged 3 commits into
mainfrom
onyx/bad-beat-callout
Oct 20, 2026
Merged

JonasFocus merged 3 commits into
mainfrom
onyx/bad-beat-callout

Conversation

@JonasFocus

Copy link
Copy Markdown
Owner

Summary

When a big favorite loses on the river of an all-in runout, the table calls it out: a short "BAD BEAT" callout over the felt and a "RIVERED" tag on the winner's row.

Changes

  • Add findBadBeat in lib/texasholdem/badbeat.ts: a contender who lost the main pot and had 75% or more to win with the four board cards from before the river. At most one qualifies, so at most one callout per hand.
  • Show the callout with the loser's name and hand for 2s once the winner is called, inside the existing showdown time. Under reduced motion the animation is off and the text is static.
  • Tag the main-pot winners' banner rows with RIVERED.

Why

Bad beats are the stories people retell. A call-out gives the loser sympathy and the winner a moment to gloat, with no added delay.

Testing

  • Unit tests: aces cracked by a king, a set beaten by a heart, a favorite that holds, a 66% favorite losing, a split pot, and an incomplete board.
  • pnpm lint, pnpm typecheck, pnpm test (372 passing) and pnpm build pass.
  • No server or protocol change; not exercised in a browser.

Notes

This PR is stacked on #89 (it reuses oddsRunner), so its base is onyx/runout-odds; retarget to main after #103 merges. Only hands that ran out after betting closed count, tracked from the runout the client saw, so a river bet-and-call or a mid-hand reload never produces a callout.

Closes #90

- Add a pure oddsRunner that enumerates flop and turn boards exactly and samples 20,000 fixed-seed boards preflop, in time slices.
- Show win percent and a separate tie figure on each contesting seat once betting is over and every live hand is face up.
- Delay the figures until the new street's cards land and read only face-up cards.

Claude-Session: https://claude.ai/code/session_01SiinSXHP71xKCXmAjpTHaM
- Add findBadBeat, which flags a loser who had 75% or more before the river, using the runout odds.
- Show a short BAD BEAT callout with the loser's name and hand for 2s inside the showdown beat, static under reduced motion.
- Tag the main-pot winner's banner row RIVERED.

Claude-Session: https://claude.ai/code/session_01SiinSXHP71xKCXmAjpTHaM
@JonasFocus JonasFocus added the ready Green and self-reviewed; waiting for merge label Oct 20, 2026
@JonasFocus
JonasFocus changed the base branch from onyx/runout-odds to main October 20, 2026 21:30
# Conflicts:
#	components/texasholdem/TexasHoldem.tsx
@JonasFocus
JonasFocus merged commit 11b9381 into main Oct 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready Green and self-reviewed; waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Call out bad beats at showdown

1 participant