A craps round that returns payouts and actually ends #31
Labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rosa/casino#31
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
2, 3 or 12; any other total establishes the point
round ends — asserted by a test
than merely announced
placing a bet cannot fail
running past the end of a script panics
bankroll now holds
roulette's precedent
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
point sevened out, and a point hit with a live Field bet
Blocked by