The site
Trophy Case
Medals and trophies for what players do in every game, worked out from the results the games already keep, and never taken back.
On this page
The Trophy Case gives players medals (bronze, silver and gold) for how far they’ve come in each game, and trophies for milestones. The decision is ADR 0088. This chapter explains the engine (what wins each award, where the facts come from, and how awards are kept) and the pages that show them. It also covers the celebration on the result sheet, a guest’s awards and each player’s public page.
Where it lives#
awards/ is a small Django app with one model. It stores only the awards themselves. Everything that wins one is read from what the games already keep.
| File | What it does |
|---|---|
awards/rules.py |
Every award there is, its step, and its name in plain words. Reads nothing from the database. |
awards/history.py |
Everything a signed-in player has finished, read from every game’s results as one list. Reads, never writes. |
awards/judge.py |
Which awards that history has won, and the moment each was won. Reads, never writes. |
awards/moments.py |
Each game’s improbable moments: what wins each, how rare it is, and which a player’s history has won. Reads, never writes. |
awards/service.py |
Keeps what’s new: after each result, and for everyone at launch. |
awards/models.py |
Award: one row per award per player. |
awards/management/commands/awards.py |
manage.py awards backfill and awards status. |
awards/case.py |
Every award as a card for one player: its state, its caption, and what its back says. |
awards/art.py |
The pictures: a medal, a trophy, an outline, a secret’s “?”, as SVG. |
awards/views.py |
A game’s shelf page, and what the result sheet asks: what was just won, a guest’s steps, a guest’s awards into an account. |
awards/cheer.py |
Winning one: the stage’s cards and words, what a guest can win, and taking a guest’s awards in. |
awards/templatetags/trophies.py |
The pieces for templates: one award, its back, a game’s landing row. |
What wins what#
Each game’s shelf starts with its first game, then holds three rows of medals and a row of trophies:
-
First game: Newcomer (playtest 1, David’s name), a ribbon rosette in the game’s color for your first finished game of it, guests too. It’s neither medal nor trophy, and it isn’t what “Every game played” counts. Its stage asks what you think: “Tell David what you think” opens Feedback, which guests can use too.
-
Rating: the rating’s steps are the ratings’ own (
ratings/medals.py, the medals). Only a settled rating counts. - What’s finished: solves for a puzzle, or wins for a table game and Solitaire. A table game with no winner counts what the table voted for instead: its result’s detail names each seat’s marks, and
MARKSgives each mark its own three steps (ADR 0098). Exquisite Corpse’s are drawing a favorite part and drawing part of a favorite corpse. Its rounds are never wins, so they count toward no win medal and never tie anyone for first. - Dailies: for a game with a daily.
awards/rules.py SOLVES · lines 23–27# What you've finished, by what a game counts (call 1; checked against real
# results on 2026-11-09). A table's win comes one game in three or four, so
# its steps are lower: in the first month, the busiest Contract Rummy player
# won 16 of 46 games, the next 9, and the regulars 5.
SOLVES = (10, 50, 200)
awards/rules.py TABLE_WINS · line 28TABLE_WINS = (3, 15, 50)
awards/rules.py MARKS · lines 31–39# A game with no winner counts what its players earn instead of wins: each
# a mark a kept game gives a seat (`Result.options["_detail"]["marks"]`),
# with its own three steps. Exquisite Corpse (David's call 8, 2026-11-12):
# drawing a part voted the favorite, and drawing part of the corpse voted
# the favorite (that one's shared by everyone who drew in it, so it comes
# more often and its steps are higher).
MARKS = {
"exquisite-corpse": (("favorite-part", (1, 5, 20)), ("favorite-corpse", (1, 10, 50))),
}
awards/rules.py DAILIES · line 29DAILIES = (7, 30, 100)
A table’s win comes about one game in three or four, so its steps are lower. The steps were checked against a month of real results before they were set.
A win at a table is first place, a tie for first included, against people or bots; but a game its rules say no one won (nobody in its result: Get in Line’s draw, Millbury Mansion’s cold case, Bowl’s tie with both teams level; David’s call, 2026-11-13) keeps its level first places for the ratings, but is no one’s win (_nobody in the kept result’s options). A game a bot covered for you counts as played, not won, and so does a table for one (Triple Take’s deck alone):
awards/history.py _tables · lines 48–79def _tables(user_id):
"""Kept table games. Won: first place (a tie for first counts), against
people or bots, in your own hands; a game a bot covered for you, or a
table for one (Triple Take's deck alone), is played, not won (call 4).
A game with no winner (awards.rules.MARKS) is never won: it counts the
marks it gave each seat instead, and ties nobody for first."""
from tables.models import Result, ResultSeat
from .rules import MARKS
mine = list(ResultSeat.objects.filter(user_id=user_id, kind=ResultSeat.PERSON)
.values_list("result_id", "result__game", "result__finished", "place", "covered", "index"))
marked = {pk: (opts or {}).get("_detail", {}).get("marks", {}) for pk, opts in
Result.objects.filter(pk__in={m[0] for m in mine if m[1] in MARKS}).values_list("pk", "options")}
# (a game no one won, a draw or a cold case: its level leaders share first place, but it's no one's win)
nobody = set(Result.objects.filter(pk__in={m[0] for m in mine}, options__has_key="_nobody").values_list("pk", flat=True))
seats = {}
for result, kind, place, total in (ResultSeat.objects.filter(result_id__in={m[0] for m in mine})
.values_list("result_id", "kind", "place", "total")):
seats.setdefault(result, []).append((kind, place, total))
done = set()
for result, game, at, place, covered, index in mine:
if result in done: # (two seats of one game for one player: it's one game)
continue
done.add(result)
everyone = seats.get(result, [])
if game in MARKS:
got = frozenset() if covered else frozenset(marked.get(result, {}).get(str(index), []))
yield Finish(game, at, f"result:{result}", False, tags=_tags(False, everyone), marks=got)
continue
won = place == 1 and not covered and len(everyone) > 1 and result not in nobody
yield Finish(game, at, f"result:{result}", won, tags=_tags(won, everyone))
The trophies are 100 games of a game, and 100 of its dailies. Across the site there are five: - your first medal; - 20 days in a row with anything finished and kept (site days, midnight Central, as dailies count); - every daily solved on its own day; - every listed game played; - 1000 games.
awards/rules.py for_game · lines 87–108def for_game(game, rated: bool) -> list[Award]:
"""A game's awards, its shelf in order: its first game, rating, count, dailies, trophies."""
# Newcomer (playtest 1, David's name, 2026-11-09): your first finished game
# of it, guests too: a rosette, neither medal nor trophy. It isn't what
# "Every game played" counts: that award stays as it was.
out = [Award(f"{game.slug}:first", game.slug, "rosette", "first", 1)]
if rated:
out += [Award(f"{game.slug}:rating:{m}", game.slug, "medal", "rating", RATING_STEPS[m], m) for m in METALS]
if game.slug in MARKS:
out += [Award(f"{game.slug}:{mark}:{m}", game.slug, "medal", "count", s, m)
for mark, steps in MARKS[game.slug] for m, s in zip(METALS, steps)]
else:
noun = counts(game)
out += [Award(f"{game.slug}:{noun}:{m}", game.slug, "medal", "count", s, m) for m, s in zip(METALS, count_steps(game))]
if game.daily:
out += [Award(f"{game.slug}:dailies:{m}", game.slug, "medal", "dailies", s, m) for m, s in zip(METALS, DAILIES)]
out.append(Award(f"{game.slug}:played", game.slug, "trophy", "trophies", PLAYED))
if game.daily:
out.append(Award(f"{game.slug}:all-dailies", game.slug, "trophy", "trophies", GAME_DAILIES))
# Its improbable moments (W5-1, awards.moments): secrets, a "?" until won (D17 4)
out += [Award(m.key, game.slug, "trophy", "trophies", secret=True) for m in moments.for_game(game.slug)]
return out
The steps were checked once against a month of real results (totals only): ADR 0088 has the figures. On that copy, before the secrets were added, the backfill gave 39 awards to 6 players.
Secrets#
Five more trophies sit on the site-wide shelf as a “?” until they’re won. Each one can be won from the start:
awards/rules.py SECRET_WORDS · lines 137–144# What a secret's card says once it's won: its name, and how it was won.
SECRET_WORDS = {
"secret:night-owl": ("Night owl", f"Finish a game between midnight and {NIGHT_OWL[1]} am."),
"secret:five-in-a-day": ("Five in a day", f"Finish {FIVE_IN_A_DAY} different games on one day."),
"secret:photo-finish": ("Photo finish", "Tie for first place at a table."),
"secret:by-a-point": ("By a single point", "Win a table game by exactly one point."),
"secret:full-house": ("Full house", f"Play a table game with {FULL_HOUSE} or more people and no bots."),
}
The three at a table read each kept game’s seats, so a finish carries tags for them. A win by a single point works whichever way a game’s scores go: it compares the winner’s total with the runner-up’s.
awards/history.py _tags · lines 82–101def _tags(won: bool, everyone: list) -> frozenset:
"""What a kept table game holds for the secrets (`awards.rules.SECRETS`)."""
from tables.models import ResultSeat
from .rules import FULL_HOUSE
tags = set()
firsts = [t for k, p, t in everyone if p == 1]
if won and len(firsts) > 1:
tags.add("tie-first")
if won and len(firsts) == 1:
rest = [p for k, p, t in everyone if p > 1]
if rest:
mine = firsts[0]
runners = [t for k, p, t in everyone if p == min(rest)]
if any(abs(mine - t) == 1 for t in runners):
tags.add("by-a-point")
if not any(k == ResultSeat.BOT for k, p, t in everyone) and len(everyone) >= FULL_HOUSE:
tags.add("full-house")
return frozenset(tags)
Improbable moments#
Every game’s shelf also holds its improbable moments (W5-1 of v2.0.0, ADR 0095): a pencil puzzle solved in under a third of its usual time, going out in six of Contract Rummy’s seven hands, a chess puzzle solved in five seconds. The research behind them is docs/releases/plans/research/w5-1-trophies.md, and David made four calls on it (D17, 2026-11-11):
- Improbable means about 5% of the chances to win it (solves, hands or games), measured again at each release against the live results. One that turns out common is tightened before it ships.
- Accounts only. A guest’s browser never judges them. A guest’s shelf says so: “Only players with an account can win those.”
- All secret. Each is a “?” on its game’s shelf until it’s won. As across the site, the ones not found yet sit together as one “?”, so nothing hints how many there are. They never show on a public page, and they aren’t the batch that “nearly everything” counts.
- A game keeps what its moments need at game over, a few counts and flags, never chat or words typed. A game finished before it kept them can’t win those.
Each is a trophy on the game’s Trophies ledge, keyed <game>:<moment> (two parts, so “your first medal” never counts it). found() reads what each needs, finds the first finish that won it, and says how in a sentence, which its card’s back and its stage show:
awards/moments.py found · lines 611–623def found(user_id: int, fs) -> dict:
"""{key: (the finish that won it, how, in a sentence)}: each moment this
history has won, at its first time."""
by_ref = {f.ref: f for f in fs}
out = {}
for key, ref, said in [*_kit(user_id), *_hashi(user_id), *_chess(user_id), *_solitaire(user_id),
*_register(user_id), *_tables(user_id, fs)]:
f = by_ref.get(ref)
if key not in BY_KEY or not f:
continue
if key not in out or (f.at, f.ref) < (out[key][0].at, out[key][0].ref):
out[key] = (f, said)
return out
A board’s usual time is the middle of everyone’s solves at that size and level before this one, once there are 10. Only what came before counts, so working it out again finds the same moment:
awards/moments.py _usual · lines 206–216def _usual(everyone, mine: set) -> dict:
"""{pk: the board's usual time before it} for each of this player's
solves (`mine`) that had `USUAL_AFTER` solves before it at its board.
`everyone` is (pk, board, when, seconds) for every solve at those boards."""
before, out = {}, {}
for pk, board, _, seconds in sorted(everyone, key=lambda r: (r[2], r[0])):
times = before.setdefault(board, [])
if pk in mine and len(times) >= USUAL_AFTER:
out[pk] = _median(times)
insort(times, seconds)
return out
At a table, a seat a bot covered for wins none, and a moment reads that game’s scores by hand. Each moment says how rare it is and how that was found: measured on the copy of real results (Oct 7 to Nov 8, 2026, totals only), or estimated from the rules where there’s no history yet.
| Game | Moment | How it’s won | How rare |
|---|---|---|---|
| Every pencil puzzle, Hashi | Lightning | Under a third of the board’s usual time | Measured: 2 of 139 solves (1.4%) |
| Chicago Traffic | Rush hour | A Hard or Expert lot in its fewest moves, under half its usual time | Measured 13% on Easy and Medium, so Hard and up only |
| Codebreaker | Three and done | A Medium or Hard code in three guesses or fewer | Estimated: about 5% even for perfect play |
| Codebreaker | Mind reader | The first guess | Estimated: 1 in 1,296 |
| The Register | Quick study | Under a third of its level’s usual time | Estimated as Lightning: about 2% |
| Chess Puzzles | Giant killer | A clean solve 300 or more above your settled rating at the time | Measured: 4 of 128 (3.1%) |
| Chess Puzzles | Blitz | A clean solve in 5 seconds or less | Measured: 6 of 128 (4.7%) |
| Chess Puzzles | Flawless twenty | 20 clean solves in a row | Measured: the longest run so far is 14 |
| Solitaire | Fast hands | Under a third of its game’s usual time | Estimated as Lightning: about 2% |
| Contract Rummy | Six of seven | Out in six or more of the seven hands | Measured: 2 of 107 games (1.9%) |
| Contract Rummy | Caught them all | Out while everyone else holds 100 or more | Measured: 11 of 245 hands out (4.5%) |
| Contract Rummy | The comeback | Alone in last after hand four, and won | Measured: 5 of 107 games (4.7%) |
| Michigan Rummy | The comeback | Alone in last at the halfway hand, and won | Estimated: about 5% |
| Michigan Rummy | Shutout | Won with everyone else at zero or below | Estimated: well under 5% |
| Euchre | Skunk | Won 10 to 0 | Estimated: 1–2% of games |
| Sixty-Six | Schwarz | A hand for 3 game points | Estimated: about 5% of hands |
| Sixty-Six | Seven–nil | Won 7 to 0 | Estimated: 2–4% of games |
| Michigan Rails | Landslide | Won a game of three or more by more than the rest put together | Estimated: rare with three or more |
| Auction House | Masterpiece | Won a game of three or more with twice the runner-up’s money | Measured: none of 6 games |
These need a count the game keeps at game over (in its chapter’s Trophy Case section), so only games finished since can win them:
| Game | Moment | How it’s won | How rare |
|---|---|---|---|
| Contract Rummy | Out on the first turn | Out on your first turn of a hand | Estimated: well under 1% of hands |
| Euchre | Lone march | Went alone and took all five | Estimated: 2–4% of hands |
| Bullshit | Honest to a fault | Won without one false claim | Estimated: under 5% |
| Bullshit | Never caught | Won after five or more false claims, none caught | Estimated: 3–5% |
| Get In Line | Double up | One chip, two new lines | Estimated: 1–2% of games |
| Michigan Rails | Every ticket | Won with every ticket finished, five or more | Estimated: 3–8%, so five or more |
| Auction House | Forger’s luck | A forgery sold at auction for the game’s top price | Estimated: under 5% |
| Millbury Mansion | Elementary | Solved on your fourth turn or sooner | Estimated: 2–4% |
| Millbury Mansion | Last one standing | Won because everyone else accused wrong, three or more | Estimated: about 5% |
| Last One Standing | Three questions | A right guess after three questions or fewer | Estimated: 5–8% with four, so three |
| Fictionary | Master forger | Every other voter fooled by your definition, five or more at the table | Bots: 5 of 30 at four, so five or more |
| Fictionary | Dictionary | The real definition found every round you voted, three or more | Estimated: 2–5% |
| Bowl | Clean bowl | A whole round’s bowl cleared in one turn | Estimated: 2–5% of turns |
| Alphabet Roulette | Twelve for twelve | All twelve answers scored in a round | Estimated: 1–2% of rounds |
| Quiz Whiz | Clean sweep | Won with every question right, six or more | Estimated: 2–4% of wins |
| Vibe Check | Bullseye run | Three bullseyes by your team in a game | Estimated: 3–5% of games |
Four games not yet on the shelf keep theirs too, and they can be won once each is listed:
| Game | Moment | How it’s won | How rare |
|---|---|---|---|
| Triple Take | Eagle eye | A whole deck won against two or more others, no wrong call | Estimated: 5–10% one against one, so three or more at the table |
| Good Question | Perfect board | Eight or more buzzes in a game, every one right | Estimated: 2–5% of games |
| Good Question | All in | Every point bet on the Last Question from behind, right, and won | Estimated: 3–5% of games |
| Turn of Phrase | Early read | A quick puzzle solved with half its letters or more face down | Estimated: 2–5% of quick puzzles |
| On a Roll | One throw | Five of a kind on a turn’s first roll | Measured on bots: 1.2% of games |
| On a Roll | Encore | An extra five of a kind, the +100 | Measured on bots: 6.0% of games |
| On a Roll | Big game | 325 or more | Measured on bots: 5.8% of games |
| On a Roll | Clean card | No zeros, and the top bonus | Measured on bots: 2.7% of games |
| On a Roll | Comeback | Last after ten rounds, then the win | Measured on bots: 5.2% of wins |
Turn of Phrase’s Clean final (the final with no wrong letter) was left out: estimated at 5–10%.
Winning one, the stage names it with its game (“You found a secret trophy in Chess Puzzles: Blitz.”) and says how it happened, then how rare it is: “You solved a puzzle rated 1500 in 3 seconds, with no mistake. Earned by 2% of players.” Its back says when. The backfill finds the ones history has already won, quietly, as it finds everything else.
When someone has nearly everything#
The first time a player holds 80% of the visible awards, or of the secrets across the site, the feedback inbox gets one item asking for a new batch, and it’s emailed as feedback is. A Nudge keeps that it asked: once per player, per kind, per batch. Adding a batch raises BATCH (now 1), so the ask can come again. The playtest server’s test players never ask.
awards/service.py nearly_all · lines 53–72def nearly_all(user_id: int) -> None:
"""The first time a player holds `rules.NEARLY_ALL` of the visible awards,
or of the secrets, ask for a new batch in the feedback inbox: once per
player, per kind, per batch. A failure is logged, never the game's."""
if settings.PLAYTEST: # (the playtest server's test players ask nothing)
return
try:
for kind, (held, of) in shares(user_id).items():
if not of or held / of < rules.NEARLY_ALL:
continue
if Nudge.objects.filter(user_id=user_id, kind=kind, batch=rules.BATCH).exists():
continue
try:
with transaction.atomic():
Nudge.objects.create(user_id=user_id, kind=kind, batch=rules.BATCH)
except IntegrityError: # (asked already, by another request)
continue
_ask(user_id, kind, held, of)
except Exception:
log.exception("awards: nearly all, for %s", user_id)
manage.py awards status starts with one line, how near the nearest player is (no names), and release:status prints that line from the live site.
History, as one list#
A finish is one solve, one loss a game keeps (a chess puzzle missed, a Solitaire deal lost), or one kept table game the player had a seat in. Losses count as played, never as solved. A daily counts once, however it was posted.
awards/history.py Finish · lines 15–31@dataclass(frozen=True)
class Finish:
game: str
at: datetime
ref: str # what it was: "hashi:solve:12", "result:34"
counted: bool # a solve, or a win: what a game's count medals count
daily: date | None = None # the daily it solved, if it was one
daily_ref: str = "" # which daily (a game can have had several on one day)
# At a table, what the secrets look for: "tie-first", "by-a-point", "full-house"
tags: frozenset = frozenset()
# What a game with no winner gave this seat toward its medals (awards.rules.MARKS)
marks: frozenset = frozenset()
@property
def day(self) -> date:
"""Its site day (midnight Central, as dailies count)."""
return timezone.localdate(self.at)
Guests have no finishes, because the site keeps nothing of theirs (AGENTS.md rule 6).
Judging, from scratch each time#
earned() reads the player’s whole history and finds the moment each award was won: the 10th solve, the result that took a rating to 1800, or the first finish on the 20th day in a row. Working it out again finds the same moment. So the backfill at launch and a result arriving now agree, and there are no counters to drift.
awards/judge.py earned · lines 150–195def earned(user_id: int, fs: list[Finish], kept: dict | None = None) -> dict:
"""Every award this history has won: {key: Won}. `kept` is what the
player already holds ({key: when}), for the one that hangs on others
(your first medal)."""
from games.catalog import listed
from ratings.sources import sources
games = listed()
rated = sources()
by_game = {}
for f in fs:
by_game.setdefault(f.game, []).append(f)
out = {}
for g in games:
mine = by_game.get(g.slug, [])
for a in rules.for_game(g, g.slug in rated):
if a.shelf == "first":
_nth(a.key, g.slug, mine, 1, out)
elif a.shelf == "count" and (mark := rules.mark_of(a)):
_nth(a.key, g.slug, [f for f in mine if mark in f.marks], a.step, out)
elif a.shelf == "count":
_nth(a.key, g.slug, [f for f in mine if f.counted], a.step, out)
elif a.shelf == "dailies" or a.key.endswith(":all-dailies"):
_nth(a.key, g.slug, _first_of_each_daily(mine), a.step, out)
elif a.key.endswith(":played"):
_nth(a.key, g.slug, mine, a.step, out)
_rating_medals(user_id, [g.slug for g in games if g.slug in rated], out)
# (a medal's key has three parts, game:shelf:metal; a trophy's two)
medals = [w.at for w in out.values() if w.key.count(":") == 2]
medals += [at for key, at in (kept or {}).items() if key.count(":") == 2]
if medals:
out["site:first-medal"] = Won("site:first-medal", "", min(medals))
for key, f in (("site:streak", _streak(fs)), ("site:sweep", _sweep(fs)),
("site:every-game", _every_game(fs, [g.slug for g in games]))):
if f:
out[key] = Won(key, "", f.at, {"ref": f.ref})
_nth("site:games", "", fs, rules.SITE_GAMES, out)
for key, f in secrets(fs).items():
out[key] = Won(key, "", f.at, {"ref": f.ref})
# Each game's improbable moments (W5-1): the finish that won each, and how, in a sentence
listed_slugs = {g.slug for g in games}
for key, (f, said) in moments.found(user_id, fs).items():
if f.game in listed_slugs:
out[key] = Won(key, f.game, f.at, {"ref": f.ref, "said": said})
return out
Kept once given#
Awards are only ever added. A ratings rebuild that moves a rating back under a step leaves its medal in place. So does a new game joining the shelf after “Every game played” was won.
awards/service.py give · lines 21–35def give(user_id: int, how: str = Award.PLAY) -> list[Award]:
"""Keep every award this player has won and doesn't hold yet. Returns
the new ones, oldest first. Safe to run any time, as often as you like."""
kept = dict(Award.objects.filter(user_id=user_id).values_list("key", "won"))
found = judge.earned(user_id, history.finishes(user_id), kept)
# (a Newcomer the backfill finds comes quietly: seen already, so no New and no box; David's call, 2026-11-09)
quiet = timezone.now() if how == Award.HISTORY else None
new = sorted((Award(user_id=user_id, key=w.key, game=w.game, won=w.at, how=how, detail=w.detail,
seen=quiet if key.endswith(":first") else None)
for key, w in found.items() if key not in kept), key=lambda a: (a.won, a.key))
if new:
with transaction.atomic():
Award.objects.bulk_create(new, ignore_conflicts=True)
nearly_all(user_id)
return new
Each Award says how it came:
- as it happened (play);
- found in history (history), at launch or a later deploy;
- won on a browser before the player had an account (guest, a later part).
seen stays empty until the player has looked at it: until then, it shows as New (“On the page”, below).
When awards are given#
- After every post. Every game’s post of a solve, or of a loss it keeps, returns
awards: the cards the result won, for its result sheet. - After every kept table game. Each signed-in seat is given its own, when the game is kept or when a seat signs in afterwards.
- On every deploy. The release phase runs
manage.py awards backfillright after the ratings’ backfill, so rating medals read finished ratings.
A failure in any of these is logged, never the game’s:
awards/service.py after_post · lines 127–136def after_post(user_id: int | None) -> list[dict]:
"""A verified solve (or a loss a game keeps) was just posted: the awards
it won, for the result sheet. A failure here is logged, never the game's."""
if not user_id:
return []
try:
return [card(a) for a in give(user_id)]
except Exception:
log.exception("awards: after a post by %s", user_id)
return []
A rating medal for a daily comes when the day’s field is rated at midnight. It’s given at the player’s next result or the next deploy, dated when the rating reached the step.
On the page#
Three places show the case, all drawn by the server from the same cards (awards/case.py), in the look of the page they’re on:
- Your account page opens with Your Trophy Case: the shelf across the site, then each game you’ve played with its own shelf in the case, every award in shelf order, two to a row where there’s room; then the nearest award you haven’t won (“Almost there: 4 more Hashi solves for a silver medal”). A card’s back there comes from the server when it’s turned over (
/awards/back/<key>/), so the page stays light however many games you’ve played. - A game’s shelf, at
/games/<slug>/trophies/, wears the game’s own look (any base its pages have): a ledge each for its rating, what you’ve finished and its dailies, then its trophies. - A game’s landing page has one row: what you’ve won in it, then the nearest one to win. The whole row is the way to its shelf (its focus ring is the card’s own, just inside its edge: round the link inside, it sat off the card’s border), one link with a chevron that lifts a little to the pointer; its medals are pictures in it, not buttons of their own (playtest 1). The server writes the row beside the game’s About band, and the house kit’s
about()places both on the start screen, so no game draws it itself. A guest’s row says how to win the first. Its heading is a section of the start screen, like the About band’s: the Heading role, in the look’s display face.
A rating’s “almost there” never says a number below zero. While a rating is provisional, it says what settles it, in the game’s own unit: “Finish 6 more Star Battle puzzles to settle your rating.” A settled rating already past a step says the medal comes with the next result.
A card is a dict. Its state is won, new (not seen yet), out (not won yet: an outline, with how to win it and how far along you are) or secret (a “?” until it’s won). Across the site, only the first secret not found yet shows, so nothing hints how many there are.
awards/case.py cards · lines 356–402def cards(user_id: int | None, awards: list | None = None, st: Standing | None = None) -> dict:
"""Every award there is, as a card for this player: {key: card}."""
every = rules.every()
kept = {a.key: a for a in (awards if awards is not None else Award.objects.filter(user_id=user_id))} if user_id else {}
st = st or Standing(user_id)
rare = rarity()
found = moments(list(kept.values()))
medals = sorted((k for k in kept.values() if k.key.count(":") == 2), key=lambda k: k.won)
by = rules.by_key()
first = rules.title(by[medals[0].key]) if medals and medals[0].key in by else ""
first = first.replace(" medal: ", " for ", 1).lower().capitalize() if first else ""
out = {}
for a in every:
ribbon, glyph = _look(a)
k = kept.get(a.key)
c = {"key": a.key, "game": a.game, "kind": a.kind, "shelf": a.shelf, "metal": a.metal or SITE_METALS.get(a.key, "gold"),
"secret": a.secret, "title": rules.title(a), "cap": _short(a), "face": _face(a), "ribbon": ribbon,
"glyph": glyph, "won": None, "fill": 0, "rare": None, "rare_mark": False}
# (on a landing row the face is too small for its number, so the caption carries it: "Rating 1600")
kind_cap = ROW_CAPS.get(a.shelf) or ("Favorite" if rules.mark_of(a)
else "Wins" if a.shelf == "count" and rules.counts(_game(a.game)) == "wins"
else "Solved" if a.shelf == "count" else "")
c["row_cap"] = f"{kind_cap} {a.step}" if kind_cap and a.kind == "medal" else c["cap"]
if k:
c.update(state="new" if k.seen is None else "won", won=k.won, how=_how(a, k, _moment(k, found), first),
guest=k.how == Award.GUEST)
c["rare"] = rare.get(a.key)
c["rare_mark"] = c["rare"] is not None and c["rare"] < RARE
elif a.secret:
c.update(state="secret", title="A secret", cap="Secret", out=SECRET_OUT if user_id or not a.game else GUEST_SECRET)
else:
text, so_far, of, fill, near = _towin(a, st)
c.update(state="out", out=text, so_far=so_far, of=of, fill=round(fill, 3), near=near,
near_long=_near_long(a, of - so_far, near) if near else "")
if a.key == "site:every-game" and so_far is not None:
c["face"] = f"{so_far} / {of}"
elif a.key == "site:games" and so_far:
c["face"] = f"{so_far:,}"
if k and a.key == "site:every-game":
from games.catalog import listed
left = [g for g in listed() if not st.played(g.slug)]
if left:
c["how"] += f" Since then, {len(left)} new game{'s' if len(left) != 1 else ''} joined the shelf."
c["label"] = (f"{c['title']}: not won yet" if c["state"] == "out" else "A secret: not found yet" if c["state"] == "secret"
else f"{c['title']}{', new' if c['state'] == 'new' else ''}")
out[a.key] = c
return out
Every award is a button. The server writes each card’s back into the page, hidden, and games/static/games/house/trophies.js turns it over. Its picture is drawn big (120px) and centered over its name. Each card turned over is a copy with ids of its own (copy()), since a picture’s gradients and masks are found by id, and Chrome won’t paint from the hidden original’s. On a shelf page with room beside the shelf, the back shows there; everywhere else it opens in the house sheet. With a mouse ((hover: hover) and (pointer: fine)), every shelf also shows a card’s back as a hover card beside it (David, 2026-11-21: “an on-hover tooltip … the better experience on desktop”). It’s the house’s tooltip (Tooltips, games/static/games/house/tip.js), given every award at once with tip(root, …, { for: '[data-award]', side: 'beside' }): it shows once the pointer rests (150 ms, the same as every tooltip), or at once when the award is reached with Tab; on the right if it fits, else the left, kept in the window (placeTip, tested in tip.test.mjs and trophies.test.mjs); it stays while the pointer is on it, and leaving it, Escape, scrolling or a click puts it away. The tooltip is the panel, so the back inside it drops its own (.aw-tip .aw-back in games/static/games/house/trophies.css). It doesn’t show over a sheet, or over the box opening but for what rises out of it. A click still turns the card over as above, and the hover card stays away while the pointer rests on that award. A back the page didn’t write in (the account’s case) is fetched as the pointer arrives. A touch screen has no hover and keeps the tap. The pictures are SVG from awards/art.py: the metals are the same in every game, the ribbon is the game’s color, and an award not won yet is drawn as an outline in the page’s own ink. A number on a face is never drawn under 10px (David’s floor, 2026-11-01): a picture too small for its number leaves it off, and its caption carries it instead. On a landing row, where the medals are small, that’s “Rating 1600” or “Solved 10”. A shelf’s medals are drawn big enough to keep theirs.
New, rare and the box#
- New stays on until the player has looked: opening the account page marks everything on it seen, and a game’s shelf page marks that game’s. The landing row shows New and leaves it. The hub’s account line says “Your Trophy Case: 3 new”.
- Rarity is the share of players who hold an award, always as a percentage: “Earned by 8% of players.” A player is anyone with anything kept, or any award. Under 10%, the card says Rare, and the award has a slow sheen. The shares are kept for ten minutes.
- The box opens once. The first time a player opens their case and every award they hold is still unseen, if the backfill found any, a walnut presentation case opens (David’s pick, playtest 1): brass inlay and a name plate (“Robin’s Trophy Case”), green felt inside. It arrives, the clasp flips, the lid swings back in depth, light fans up, and the awards rise out one at a time onto a lit walnut shelf while the count ticks (with a mouse, pointing at one shows its hover card, over the box: David, 2026-11-21), about seven seconds in all (
BOXingames/static/games/house/trophies.js). The shelf shows the first 16, then “+4 more”; however many there are, they all rise within a few seconds. Under reduced motion it’s the last frame, still.
The styles are games/static/games/house/trophies.css, which each piece links itself. Its layout and ink are the look’s own tokens, as the house kit’s are. The awards’ own palette is declared once at its top, the same in every game: the metals, the New red, the wooden shelves and the box. It’s a sheet of its own because house.css may set no color of its own (Rules and checks).
Winning one#
Every game ends on the house kit’s result sheet (Front end), so that’s where an award is celebrated, after the game’s own celebration (call 13). When a result sheet opens on a page that says where to ask (awards_config, written beside the About band), it waits for the celebration it opened with to play out (a win’s is 3 seconds) and then a deciding move’s hold (MOTION.holdKey, 2 seconds) to read the sheet, never less than 1400 ms in all, and asks. At a flat 1.4 seconds the stage covered a winner’s “You won!” mid-confetti (playtest 3, 2026-11-19). A sheet put away sooner has been read: the stage comes then (still not under the least), not seconds later over the next puzzle or game, where it took the board away mid-stroke (Griddles’ play check, the same round).
What it won is asked at that least, not after the read, so the sheet soon knows whether a stage is coming. Until then, and while one is up, the sheet’s buttons hold their action (awardHold() in games/static/games/house/end.js): pressing New puzzle, Restart or the like puts the sheet away, the stage comes at once, and the action runs when the stage is put away. Before, New puzzle started the next puzzle and its clock under the award (playtest finding 2.0.0 #37, on a phone). Links (Leaderboard) and Share result are left alone, and an answer not back in 5000 ms counts as nothing, so a button is never dead. tools/house/kit.test.mjs holds both ways.
- A signed-in player asks the server what they’ve just won (
/awards/fresh/): awards won in play, given in the last 12:00:00 and not celebrated yet. Asking marks themcheered, so each is celebrated once. It’s the same for a solo game’s post and a table’s game over, whichever arrived. A daily counts like any other finish, and the backfill reads past dailies too (playtest 2 checked it); what doesn’t count is a solve the game refused to keep, such as one quicker than its size’s floor (“That time doesn’t look like a real solve.”), since only kept results are history. A guest’s browser counts any finished sheet. What the backfill found, and a guest’s awards taken in, are never celebrated here. - A Newcomer gets its own stage: the rosette pops in, its confetti in the game’s color, and “You’ve played your first game of Hashi.” with “Tell David what you think” (Feedback) and “Keep playing”. The backfill gives it quietly to everyone who had already played: seen, so no New, no stage and no box.
- A guest’s browser counts the result itself and judges what it won against the steps the server lists for this game (below).
awards/cheer.py fresh · lines 77–89def fresh(user) -> dict:
"""What this player has just won in play and not seen celebrated, oldest
first, and the stage's headline; once asked for, it's celebrated (never twice)."""
since = timezone.now() - FRESH
awards = sorted(Award.objects.filter(user=user, how=Award.PLAY, cheered__isnull=True, given__gte=since),
key=lambda a: (a.won, not a.game, a.key)) # (a game's own first, then the site's it brought)
if not awards:
return {"cards": [], "headline": ""}
cards = case.cards(user.pk)
out = [stage_card(cards[a.key]) for a in awards if a.key in cards]
said = headline_all(out) if out else ""
Award.objects.filter(pk__in=[a.pk for a in awards]).update(cheered=timezone.now())
return {"cards": out, "headline": said}
The stage (games/static/games/house/trophies.js, stage()) is the spotlight, the award dropping in on its ribbon (a medal) or rising onto its plinth (a trophy), confetti in the metal’s colors, and one plain sentence: “You won a silver medal in Hashi.” Several share one stage (“You won three awards in Contract Rummy.”): they arrive one after another, and pointing at one, or tapping it, turns it to its back. The backs share one place, as tall as the tallest of them (each held by an unseen copy in the same grid cell), so pointing from one to the next never moves the rest of the stage (David, 2026-11-21, #34). On a phone (560px wide or tall, or less) several awards stand smaller, four to a row, so four awards with a signed-in player’s back and both buttons fit a small iPhone’s screen (about 500px tall; in two rows they ran 720px, and the buttons went off the foot). Taller than the screen, the stage scrolls inside: its words start at the top (margin: auto, centered only while they fit) and the spotlight is fixed to the screen, so the result sheet under it never shows through (David, 2026-11-21). “See my Trophy Case” goes to the account page, and “Keep playing”, its ✕ (the stage’s corner, as a sheet’s), Escape or a press off its words and buttons puts it away; a press on its own words, to read or select them, never does (David, 2026-11-21: one “abruptly dismissed” the surprise). It’s a dialog as the house’s sheets are: the focus goes to its first button, what’s behind it (a result sheet too) is inert while it’s up, Tab stays among its buttons, Escape puts it away before any sheet under it hears the press (escapeOverSheets), and the focus goes back where it was. Under reduced motion it fades in, still.
Guests#
A guest wins what their browser can judge (call 8): their first game of each (Newcomer), what they’ve finished of each game, its dailies, 100 of it, and across the site their first medal, every game played and 1,000 games. A guest has no rating, and their browser doesn’t keep the runs of days or the secrets, so those wait for an account.
awards/cheer.py guest_winnable · lines 97–105def guest_winnable(a: rules.Award) -> bool:
"""What a guest's browser can judge (call 8): counts and milestones. Not
a rating (only an account has one), a run of days, every daily in a
day, or a secret."""
if a.secret or rules.mark_of(a):
return False
if a.game:
return a.shelf != "rating"
return a.key in GUEST_SITE
The browser keeps a guest’s own log (uo:awards:guest): each game’s results played and won, counted from the result sheet (a win is a solve, or first place at a table), and what it has won, with when. Each result counts once, by its id: a table’s code and game number (the room kit says, identifyResults), else the page and what its sheet says (the puzzle’s number or day, its time, the scores: resultKey in games/static/games/house/end.js). So the same finished sheet shown again after a reload counts nothing. Its dailies come from the browser’s log of dailies. judgeGuest() reads the steps from /awards/guest/<slug>/, with each award’s card, and keeps whatever’s newly reached:
games/static/games/house/trophies.js judgeGuest · lines 226–263/**
* Count one result for a guest and keep what it wins: counts and
* milestones only (a guest has no rating, call 8), judged as the server
* would. Returns the new cards, for the stage.
*/
export function judgeGuest(rules, { won = false, key = '', store = keep, log = { items: {} }, now = new Date() } = {}) {
const g = readGuest(store);
// (each result once: the same finished sheet shown again, after a reload, counts nothing)
if (key) {
if (g.counted.includes(key)) return [];
g.counted = [...g.counted, key].slice(-COUNTED);
}
const slug = rules.game;
const mine = g.games[slug] || { played: 0, counted: 0 };
mine.played += 1;
if (won) mine.counted += 1;
g.games[slug] = mine;
const dailies = Object.entries(log.items || {}).filter(([item]) => slugOf(item) === slug).reduce((n, [, days]) => n + Object.keys(days || {}).length, 0);
const total = Object.values(g.games).reduce((n, x) => n + (x.played | 0), 0);
const fresh = [];
const win = a => { g.won[a.key] = now.toISOString(); fresh.push(a.card); };
for (const a of rules.awards || []) {
if (g.won[a.key] || a.key === 'site:first-medal') continue;
const reached = a.what === 'first' ? mine.played >= 1
: a.what === 'counted' ? mine.counted >= a.step
: a.what === 'dailies' ? dailies >= a.step
: a.what === 'played' ? mine.played >= a.step
: a.what === 'site:games' ? total >= a.step
: a.what === 'site:every-game' ? (rules.listed || []).length > 0 && rules.listed.every(s => (g.games[s]?.played | 0) > 0)
: false;
if (reached) win(a);
}
// (your first medal comes with the first medal of any game, as the server's does)
const first = (rules.awards || []).find(a => a.key === 'site:first-medal');
if (first && !g.won[first.key] && Object.keys(g.won).some(k => k.split(':').length === 3)) win(first);
store.set(GUEST, g);
return fresh;
}
A guest’s stage ends with an invitation: “Keep it in your own Trophy Case”, with Create a free account and Not now. Its buttons are drawn in the invitation’s own paper and ink, not the game’s (a felt game’s light buttons vanished on the paper).
- Signing up brings them. The sign-up form carries the browser’s awards in a hidden field, and the new account takes them in.
- Signing in on a browser that holds a guest’s awards asks once: “Add 2 awards won on this browser to your Trophy Case?” Add them (
/awards/merge/), or “They’re not mine”, and they stay in the browser.
Either way, only what a guest can win is taken in, each once, kept as won on this browser (Award.GUEST), its card saying so:
awards/cheer.py merge · lines 130–151def merge(user, won: dict) -> int:
"""A guest's awards, from their browser, into this account: only what a
guest can win, kept as won on this browser, never twice. Returns how many
were added."""
by = rules.by_key()
held = set(Award.objects.filter(user=user).values_list("key", flat=True))
now = timezone.now()
new = []
for key, when in list(won.items())[:200]:
a = by.get(key)
if not a or key in held or not guest_winnable(a):
continue
try:
at = min(datetime.fromisoformat(str(when).replace("Z", "+00:00")), now)
except ValueError:
at = now
if timezone.is_naive(at):
at = timezone.make_aware(at)
new.append(Award(user=user, key=key, game=a.game, won=at, how=Award.GUEST, cheered=now))
if new:
Award.objects.bulk_create(new, ignore_conflicts=True)
return len(new)
The public page#
Every account has a page anyone can open, at /players/<key>/ (call 9). The key is the account’s own, made when it’s made, and it never changes, so a link to it keeps working whatever the player is called. It shows their name, when they joined, their three rarest awards (each named in full, with its rarity), what they’ve won across the site and in each game, and their ratings.
It never shows an outline, progress or New, and never a secret, even one they’ve won: on someone else’s page, its name would be a hint. A card’s back there says what it is, when it was won and how rare it is, but not how: that’s the player’s own.
awards/case.py public · lines 502–523def public(user) -> dict:
"""What a player's public page shows (call 9): what they've won, never an
outline, progress or a secret, and no New."""
from games.catalog import listed
from ratings.boards import yours
by = rules.by_key()
awards = [a for a in Award.objects.filter(user=user) if a.key in by and not by[a.key].secret]
all_cards = cards(user.pk, awards)
won = [{**all_cards[a.key], "state": "won", "how": "", "label": all_cards[a.key]["title"]}
for a in sorted(awards, key=lambda a: a.won) if a.key in all_cards]
rarest = sorted((c for c in won if c["rare"] is not None), key=lambda c: (c["rare"], c["won"]))[:3]
# (up front, each says what it is: "Hashi rating 1800", not only its metal)
rarest = [{**c, "cap": c["title"].split(": ", 1)[1] if c["kind"] == "medal" else c["title"]} for c in rarest]
rows = [("Across the site", [c for c in won if not c["game"]])]
rows += [(g.title, [c for c in won if c["game"] == g.slug]) for g in listed()]
try:
ratings = yours(user)
except Exception:
ratings = []
return {"won": len(won), "rarest": rarest, "rows": [(name, cs) for name, cs in rows if cs], "ratings": ratings}
It’s public unless the player hides it, with one row in Settings on their account page: “Show my Trophy Case on my public page” (User.public). Hidden, it’s a 404 to everyone but them, and they see it with a note that only they can. Search engines are asked not to index it. The account page’s Trophy Case links to it: “See your public page”. So does every player’s name on a leaderboard (a game’s boards and its ratings) and on a table’s result: the boards’ player filter links a name when that account’s page is shown, and never for a guest, a bot or a hidden page. The accounts it links are kept for a minute, and dropped whenever an account is made, saved or deleted.
Tests#
tests/test_awards.py holds the rules as sentences:
- the 10th solve wins bronze, and your first medal with it;
- what a win at a table is;
- a provisional rating wins nothing;
- a rebuild never takes a medal back;
- the site-wide trophies, judged over a history made up in the test;
- the backfill gives once, however often it runs.
tests/test_trophy_case.py holds the pages: each card’s state and what its back says, rarity and Rare, the nearest award, New until seen, the box opening once, a game’s shelf in its look, the landing row, and the hub’s count. It also holds winning one: celebrated once, never for the backfill, a guest’s steps, a guest’s awards taken in once (only what a guest can win), and sign-up bringing them; the public page: a key each, what it shows and leaves out, hidden in Settings; names linked on a table’s result, never for a hidden page or a guest; and no number on a face under 10px. tests/test_moments.py holds the improbable moments: what wins each (and the near misses that don’t), every game that keeps a count for them played to its end by bots (Bowl’s turn’s end by hand) and keeping numbers only, a board’s usual time, a covered seat winning none, the one “?” until won, the stage’s words, a guest told they need an account, the public page leaving them out, and the backfill finding them quietly. tools/house/trophies.test.mjs holds a guest’s browser: a solve counted and a loss only played, the medal at its step with the first medal, dailies from the log, the site’s milestones, the stage’s headline, a finished sheet shown again after a reload counting once, and the hover card beside its award (the house tooltip’s placeTip; the rest of its behavior is the tooltip’s own, in tools/house/tip.test.mjs).