A craps round that returns payouts and actually ends #31

Closed
opened 2026-08-12 17:44:19 +00:00 by rosa · 0 comments
Owner

Parent

#27

What to build

The core of the parent spec: a craps round that owns the point and the positions,
answers in payouts rather than printed lines, and ends the way craps rounds end.

From the player's side, three things change. A Pass Line or Don't Pass wager is
settled whichever way the round finishes, instead of vanishing the moment a point
is established. Sevening out ends the round and takes the line, instead of paying
Come bets and rolling on forever. And Mister Green turns up on every exit from
the table rather than only the remembered ones.

The round exposes, in the order a caller uses them: a constructor taking nothing;
a second constructor taking a scripted sequence of dice pairs as the determinism
seam; the bets currently on offer; placing a bet with a wager already taken from
the bankroll; rolling; settling what that roll resolved; the point, if one
stands; and whether the round is finished. The phase itself stays private — the
UI is given the point and a finished flag, not a state to branch on.

The line bet becomes an ordinary position placed through the same call as every
other bet. That is what fixes the vanishing wager: there is no second path left
to forget. When the round ends, the line settles by the event that ended it — the
point wins Pass and loses Don't Pass, sevening out does the reverse — and every
other surviving position resolves as a loss, returned as payouts so the bankroll
and the announcement cannot disagree.

Come and Don't Come keep today's simplification, deliberately: they do not travel
and do not take points of their own. That is tracked in #28.

Design decisions carried from the parent spec: randomness lives inside the round,
injected through the scripted-dice constructor, and a script that runs out
panics. Dice are scripted as pairs rather than totals, so bets that need to see
both dice do not force a signature change later. A roll is a named type exposing
its total and both dice. Settling is pure and per roll; rolling is what mutates.
A payout carries the bet it settled rather than a position index, because craps
positions name themselves. The outcome type gains a push variant now even though
nothing pushes yet, so that #33 has something to express bar-12 with. Placement
cannot fail: the round only offers bets it can settle in the current phase, and
the UI only offers money it has already taken from the bankroll. The tumbling
dice stay entirely in the UI, since they are a screen effect with no claim on the
outcome.

Acceptance criteria

  • A come-out roll of 7 or 11 settles the line immediately, as does one of
    2, 3 or 12; any other total establishes the point
  • Sevening out ends the round, winning Don't Pass and losing Pass
  • Hitting the point ends the round, winning Pass and losing Don't Pass
  • Every wager placed is settled by exactly one payout, whichever way the
    round ends — asserted by a test
  • Positions still standing when the round ends are settled as losses rather
    than merely announced
  • The bets on offer differ between the come-out and the point phase, and
    placing a bet cannot fail
  • The round holds no reference to the bankroll and prints nothing
  • A scripted sequence of dice pairs drives a whole round from a test, and
    running past the end of a script panics
  • Mister Green and the save are reached from every way the round can end
  • The player is told, per position, what it paid or cost and what their
    bankroll now holds
  • Announcement wording is asserted from a genuinely settled round, following
    roulette's precedent
  • Tests cover: come-out win, come-out loss, point established, seven-out
    settling both sides of the line, point hit settling both sides, a Field bet
    paying and losing, leftovers resolving as losses, and the bets on offer per
    phase
  • Tests sit at the foot of their own file, as baccarat and roulette do
  • The test suite passes and the linter is clean
  • Four rounds played at the terminal: a come-out win, a come-out loss, a
    point sevened out, and a point hit with a live Field bet

Blocked by

## Parent #27 ## What to build The core of the parent spec: a craps round that owns the point and the positions, answers in payouts rather than printed lines, and ends the way craps rounds end. From the player's side, three things change. A Pass Line or Don't Pass wager is settled whichever way the round finishes, instead of vanishing the moment a point is established. Sevening out ends the round and takes the line, instead of paying Come bets and rolling on forever. And Mister Green turns up on every exit from the table rather than only the remembered ones. The round exposes, in the order a caller uses them: a constructor taking nothing; a second constructor taking a scripted sequence of dice pairs as the determinism seam; the bets currently on offer; placing a bet with a wager already taken from the bankroll; rolling; settling what that roll resolved; the point, if one stands; and whether the round is finished. The phase itself stays private — the UI is given the point and a finished flag, not a state to branch on. The line bet becomes an ordinary position placed through the same call as every other bet. That is what fixes the vanishing wager: there is no second path left to forget. When the round ends, the line settles by the event that ended it — the point wins Pass and loses Don't Pass, sevening out does the reverse — and every other surviving position resolves as a loss, returned as payouts so the bankroll and the announcement cannot disagree. Come and Don't Come keep today's simplification, deliberately: they do not travel and do not take points of their own. That is tracked in #28. Design decisions carried from the parent spec: randomness lives inside the round, injected through the scripted-dice constructor, and a script that runs out panics. Dice are scripted as pairs rather than totals, so bets that need to see both dice do not force a signature change later. A roll is a named type exposing its total and both dice. Settling is pure and per roll; rolling is what mutates. A payout carries the bet it settled rather than a position index, because craps positions name themselves. The outcome type gains a push variant now even though nothing pushes yet, so that #33 has something to express bar-12 with. Placement cannot fail: the round only offers bets it can settle in the current phase, and the UI only offers money it has already taken from the bankroll. The tumbling dice stay entirely in the UI, since they are a screen effect with no claim on the outcome. ## Acceptance criteria - [ ] A come-out roll of 7 or 11 settles the line immediately, as does one of 2, 3 or 12; any other total establishes the point - [ ] Sevening out ends the round, winning Don't Pass and losing Pass - [ ] Hitting the point ends the round, winning Pass and losing Don't Pass - [ ] Every wager placed is settled by exactly one payout, whichever way the round ends — asserted by a test - [ ] Positions still standing when the round ends are settled as losses rather than merely announced - [ ] The bets on offer differ between the come-out and the point phase, and placing a bet cannot fail - [ ] The round holds no reference to the bankroll and prints nothing - [ ] A scripted sequence of dice pairs drives a whole round from a test, and running past the end of a script panics - [ ] Mister Green and the save are reached from every way the round can end - [ ] The player is told, per position, what it paid or cost and what their bankroll now holds - [ ] Announcement wording is asserted from a genuinely settled round, following roulette's precedent - [ ] Tests cover: come-out win, come-out loss, point established, seven-out settling both sides of the line, point hit settling both sides, a Field bet paying and losing, leftovers resolving as losses, and the bets on offer per phase - [ ] Tests sit at the foot of their own file, as baccarat and roulette do - [ ] The test suite passes and the linter is clean - [ ] Four rounds played at the terminal: a come-out win, a come-out loss, a point sevened out, and a point hit with a live Field bet ## Blocked by - #29 - #30
rosa closed this issue 2026-08-14 03:02:02 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rosa/casino#31
No description provided.