Board games
On a Roll
The five-dice scorecard game. Roll up to three times, keep what you like, and fill one of thirteen boxes a turn, alone, against bots or with family, 1 to 8.
On this page
On a Roll is the five-dice scorecard game for 1 to 8. Each turn a player rolls five dice up to three times, keeping any between rolls, then fills one empty box of thirteen on their card with what the dice score there, a 0 if they don’t fit. The top half has a box for each number and a bonus at 63; the bottom half has the patterns (three and four of a kind, a full house, two straights, five of a kind, chance). Another five of a kind earns +100, and the official joker rule says where it goes. Thirteen rounds fill every card, and the highest total wins.
It plays the classic in its own rules’ words, with our own name, card and look (David’s eleven calls of 2026-11-13 are in docs/on-a-roll.md). It’s a table game on the table service, a room-kit table in the browser (the front end), the first game on the dice kit (ADR 0106), and kept games with others are rated (Ratings).
At a glance#
| Part | Where |
|---|---|
| Rules: a turn, the boxes, the bonuses, the joker, everyone at once | tables/on_a_roll/rules.py |
| Bots: three levels, each turn solved exactly | tables/on_a_roll/bots.py |
| The dice: rolled on the server; the die, the throw and the sounds | tables/dice.py, games/static/games/house/dice.js |
| The table: the chips, your card, the shared score pad, the tray, the dock, the moments | games/static/games/on-a-roll/table.js |
| The entry: the lobby’s settings | games/static/games/on-a-roll/app.js |
| Its look: tokens, the pad, a box, a chip; the table’s layout | games/static/games/on-a-roll/on-a-roll.css, games/static/games/on-a-roll/table.css |
| How to play | games/rulebooks/on-a-roll.md |
| Tests | tests/test_on_a_roll.py |
| A table set to a moment; a whole game played in a browser | tools/on-a-roll/stage.py, tools/on-a-roll/play.mjs |
| The bots’ strength and the trophies’ rarity, measured | tools/on_a_roll/strength.py |
| Rules and design notes | docs/on-a-roll.md |
The rules in code#
The state is a card per seat (each box a number, or nothing yet), each seat’s hand (its dice, which are kept, how many rolls), the extra five of a kinds, and the round’s order. A turn is roll (with the dice to keep), hold (keeps shown to the table before the roll) and score (a box). What dice score in a box:
tables/on_a_roll/rules.py points · lines 68–92def points(dice, box: str, joker: bool = False) -> int:
"""What these dice score in this box. A joker (call 5: five of a kind with
its own box filled) scores Full house and both straights at full value."""
c = kit.counts(dice)
total = sum(dice)
if box in UPPER:
face = UPPER.index(box) + 1
return face * c[face]
most = max(c.values())
if box == "three_kind":
return total if most >= 3 else 0
if box == "four_kind":
return total if most >= 4 else 0
if box == "full_house":
# (five of a kind is a full house only as a joker: call 11, the official rule)
return FULL_HOUSE if joker or sorted(c.values()) == [2, 3] else 0
if box == "small_straight":
return SMALL if joker or straight(dice, 4) else 0
if box == "large_straight":
return LARGE if joker or straight(dice, 5) else 0
if box == "five_kind":
return FIVE if most == 5 else 0
if box == "chance":
return total
raise ValueError(box)
Five of a kind with its own box already filled is a joker, and the official rule (call 5) narrows the boxes it may go in:
tables/on_a_roll/rules.py allowed · lines 100–111def allowed(card: dict, dice) -> list[str]:
"""The boxes these dice may go in. Usually every empty one; a joker
(the official rule, call 5) must take its own top box if that's empty,
else any empty bottom box, else any empty top box (for 0)."""
empty = [b for b in BOXES if card[b] is None]
if not is_joker(card, dice):
return empty
own = UPPER[dice[0] - 1]
if card[own] is None:
return [own]
lower = [b for b in LOWER if card[b] is None]
return lower or [b for b in UPPER if card[b] is None]
The top half’s bonus is 35 at 63; each extra five of a kind adds 100 once the box holds 50. After each turn the server holds a beat so every screen shows it the same: 1.2 s, 2.5 s more for five of a kind, and 8 s for the final tally. With the table’s “Everyone at once” setting (call 3), every seat plays the round at once and the round’s beat comes when the last one scores.
What each seat sees#
Everything but the dice to come. Every card, die and keep is public; the rolls come from the table’s secret seed and where each happens (tables/dice.py), and the seed never reaches a view. On your turn the view says what the dice would score in each box they may go in (can.hints), so the screen shows them without doing the arithmetic itself, and how many rolls are left.
The bots#
Three levels, a person’s way of playing each, never seeing a roll before it’s made (tables/on_a_roll/bots.py). A turn’s whole tree is small, 252 different sets of five dice and 462 different keeps, so Medium and Hard solve each turn exactly:
tables/on_a_roll/bots.py solve · lines 59–80def solve(value) -> tuple[dict, dict]:
"""The turn solved: `value(hand)` is what scoring a final hand is worth.
Returns (best[r][hand], keep[r][hand]) for r = rolls left (0, 1, 2):
best is what the hand is worth with r rolls left, and keep the keep that
gets it (None: stop and score)."""
best = {0: {h: value(h) for h in HANDS}}
keep = {0: {h: None for h in HANDS}}
for r in (1, 2):
exp = {}
for k in {k for h in HANDS for k in _subkeeps(h)}:
if len(k) == 5:
continue
exp[k] = sum(p * best[r - 1][tuple(sorted(k + o))] for o, p in OUTCOMES[5 - len(k)])
best[r], keep[r] = {}, {}
for h in HANDS:
stop = best[0][h]
pick, got = None, stop
for k in _subkeeps(h):
if len(k) < 5 and exp[k] > got + 1e-9:
pick, got = k, exp[k]
best[r][h], keep[r][h] = got, pick
return best, keep
Easy keeps the dice it has most of and scores what pays most now; Medium plays each turn for its most points, nudged toward the top bonus; Hard weighs each box against what it’s worth kept open (its par) and the top half’s progress. Measured by tools/on_a_roll/strength.py (seeded games, 95% intervals, 2026-11-13): alone, Easy averages about 165, Medium 221 and Hard 242; head to head, Hard beats Medium 59.9% and Medium beats Easy 83.3%. A bot takes 1 s over a roll. Bots sit at the default spacing in ANCHORS (ratings/tables.py) until they’re measured.
The trophies#
Five improbable moments (ADR 0095), measured on 3,200 seat-games of Medium and Hard bots before naming (strength.py moments), and kept in the result’s detail: One throw (five of a kind on a first roll, 1.2%), Encore (an extra five of a kind, 6.0%), Big game (325 or more, 5.8%), Clean card (no zeros and the top bonus, 2.7%) and Comeback (last after ten rounds, then the win, 5.2% of wins). They’re judged in awards/moments.py and won once the game is listed.
The interface#
The table (the mockups David approved, 2026-11-13). On a phone: the players as chips across the top (mark, name, total, what they’re doing; a tap opens their card), your card in two halves, the tray and the dock under your thumb. On a laptop: the tray and the dock at the left, the shared score pad filling the rest, one column per player as a family keeps score, the log pinned at 1280. Things stay put: the tray’s five places, the dock’s two buttons in fixed slots, the card’s rows sharing its height. On a phone each box is at least a finger’s height (44px), so a short phone scrolls the card in its own place rather than shrink it. The card’s middle row is at least its rows’ height, so the Total stays under them: it took the place’s height instead and the rows ran under the Total (212px of them at 320×640, 25px at 375×812: playtest 3, 2026-11-20). The tray sizes five dice to its own width (a container query: up to 56px, 44px at 320), and each die takes the tray’s size: the dice kit sets --die on every die, so the tray’s phone size never reached them and 54px dice spilled past a 320 tray. A kept die lifts 10px with its ring 4px further out, so the dice sit 8px below the tray’s label (14px on a phone), clear of it.
- A turn (calls 4 and 6): Roll (Space, or R with Shortcut keys on; Space always works, but a die or button reached with Tab keeps Space for itself, so Tab to a die and Space keeps it). Tap a die to keep it (1 to 5): it lifts a step, ringed, with its Kept tab, and the table sees it a moment later (
hold). Roll the rest. Each empty box shows faintly what the dice would score there (the helper “Show what each box would score”, on at first); a box tapped is tried, ringed in ink with its number pencilled in, and the dock asks “Score 25 in Full house?”; Score (Enter) writes it, Cancel (Escape) lets it go. Nothing marks a best box. After any roll you may score: Score is live from the first roll, and pressed before a box is tried it says “Pick a box. Tap a box in your column to score these dice there.” and moves the keyboard’s place to your first open box (a greyed Score read as “you must roll three times”: Vera, 2026-11-22). Your move rings Roll again and Score, each on its own, after a few idle seconds. - The focus by keys (the 2026-11-13 accessibility audit): a move redraws the table, and a focus that was on it goes back to the same control (by its name, or its place among its kind, as a picked box renames itself), or to the first thing you can press now; with nothing to press, to the dock, so the next Tab goes on from the table rather than from the top of the page (
keepFocus). - The throw (the dice kit): the dice not kept fly in from the cup side and land in their places one after another, on the server’s faces; a kept die never moves. A throw’s places stay empty until it plays, so a die is never seen before it lands.
- The dock says what’s happening in a player’s words: “Mom is rolling. Roll 2 of 3.”, “Keeping three dice. Roll the other two, or pick a box.”, “Your Five of a kind box is filled, so five 4s go in Fours.”
- The big moments (call 10): five of a kind lines the dice up and the announcement band says it on every screen (“Five 6s!”); the top bonus stamps +35 and the top half glows once; the final tally runs one half at a time, every card side by side, then the result sheet, with your best score kept in this browser. A win is the room’s to celebrate (once a game), as every table game’s; a new best score that isn’t a win plays
best, with the sheet’s New best tag, as a solo game’s does. Skip hurries any of them. - Options: the hints (on), and Sounds (a rattle and a clatter, off at first).
Its look#
On a Roll’s personality, in the design system’s personality sheet.
| Family | Board and party: the room kit in a look of its own. Checked on phones as closely as on a laptop. Everything else is the room kit’s (Board and party games). |
| Palette | Ink #2a2118 on cream paper; the one fill #2a2118; yours #c2410c, a burnt orange; good #2f7a52 and bad #b42318. A kitchen table: oak, a tray lined with blue felt, a cream score pad ruled in pale blue, scores in pencil, and the hints in a quiet blue. |
| Faces | Young Serif for the title and the pad’s headings; Figtree for everything else; Kalam for what’s written on the pad |
| Corners and edges | Panels 12px, buttons 10px; the pad’s sheets stacked under it, a binding along its top |
| Board | The pad: printed box names, what each takes under it, pencilled scores. A crossed-off box is struck through. The die is the site’s mark, the bevel, in cream and ink. Picked: a box ringed in ink; kept: a die lifted and ringed. |
| Emblem and art | Its box on the shelf: a score pad with its top half pencilled in, a pencil, and a felt tray holding five sixes |
| Voice | Your card, the top half, the bottom half, the tray, kept; “Roll the dice”, “Score 25 in Full house?”, “Five 6s!” |
| Payoff | Five of a kind’s band, the bonus’s stamp, the final tally; the room’s celebration for a win, a personal best’s for your best |
| The glance | Now: the dock. The countdown: “Round 8 of 13” and the rolls left. The score: each chip and the pad’s totals. Yours: your chip, your column, your kept dice. |
| Exceptions | None yet |
Testing#
tests/test_on_a_roll.py holds the dice kit’s server half, the rules as sentences (what dice score, a turn, the bonuses, every joker branch, everyone at once, the hints), the bots, what’s kept for the trophies and how each is won, and the table contract (scrambling the seed). tools/on-a-roll/play.mjs (npm run check:on-a-roll:play, --size for a phone, --together for everyone at once) plays a whole game in a headless Chrome against a quick Medium bot: Roll, dice kept and staying put, the hints, a box tried, cancelled and scored, five of a kind and the top bonus staged on the way, the tally and the result sheet. tools/on-a-roll/stage.py sets a table to a turn, late in the game, five of a kind, the bonus or the last box (the details check and the playtest’s Test it).
Changing it#
- The beats are in two places: the rules’
TURN_SECS,FIVE_SECSandTALLY_SECS, and the table’s waits (scoredShow,TALLY_MS). Change both, or the next turn starts under a moment still playing. - The die is the dice kit’s: its look in
games/static/games/house/dice.css, colored by this game’s--die-*tokens; the throw’s pace isthrowandthrowGapin the motion vocabulary. - A trophy’s line is in
awards/moments.pyandwon()intools/on_a_roll/strength.py; measure it again before changing it.
Rating#
A kept game with others is rated by place like every table game (Ratings), ties sharing the place. A game alone isn’t rated.