Static trivia and quiz games (daily sets, question banks, fact checking)
triviaquizstatic-siteseeded-randomlocalstoragequestion-bankfact-checking
A trivia game needs no backend: a question bank in one JavaScript file, a seeded random number
generator for the shared daily round, and localStorage for scores. Two sites were built this
way in November 2026 from one engine: Rewind (90s movie trivia, trivia.jhampton.io) and D'oh!
(a fan-made Simpsons quiz, simpsons.jhampton.io). The engine is plain HTML, CSS and JS with no
build step (see Zero-build web apps (vanilla JS, localStorage, single file)). What makes or breaks such a game is the
question bank, not the code.
The question bank
- One file, one row per question, positional fields:
[category, difficulty 1-3, question, correct, wrong, wrong, wrong, fun fact]. The correct answer is always the fourth field; the game shuffles the four choices at display time. Rows are quick to write, diff well, and are easy to validate. - Give each question a stable id derived from its text (a 32-bit FNV-1a hash in base 36) instead of its index, so adding or reordering rows does not scramble the "recently seen" history stored on players' devices.
- The fun fact shown after every answer is what makes a wrong answer feel worthwhile. It is also where errors hide (see fact checking below).
- A validator script run by the deploy catches the mechanical mistakes: wrong field count, unknown category, difficulty outside 1-3, empty fields, duplicate choices within a question (compared case-insensitively), duplicate questions, a category with no questions at some difficulty, and too few questions to build a daily round. It also prints a count per category and difficulty, which shows the thin spots at a glance. About 225 to 250 questions in six categories was enough for launch.
Fact-check the bank with a second pass
A bank written from memory (by a person or a language model) needs an independent check before it goes public. For the Simpsons bank, a second agent with web search verified all 251 rows: every answer held, but three fun facts were wrong and two more had to be softened. The pattern is general: the answer to a question is usually a famous, well-rehearsed fact, while the supporting trivia is the kind of half-remembered detail that gets embellished. Check the side facts at least as hard as the answers, and prefer cutting a fact to hedging it. The movie bank launched with self-review only, which is the weaker position.
A daily round everyone shares
Everyone who plays on the same day should get the same ten questions, without a server:
1. Build a key from the local date (YYYY-MM-DD).
2. Hash a namespaced string ("rewind-daily-" + key) to 32 bits with FNV-1a and use it to seed
a small PRNG (mulberry32).
3. Shuffle the whole bank with that PRNG (Fisher-Yates), bucket by difficulty, and take a fixed
ramp: 4 easy, 4 medium, 2 hard.
4. Use the same PRNG for the order of the answer choices, so two players comparing notes
saw the same screen.
Math.random cannot be seeded, which is why the game carries its own generator. The first run
of the day is the saved score and later runs are practice; otherwise the daily score means
nothing. A streak counter walks backward through the saved days, starting from yesterday if
today has not been played yet, so the streak does not read zero every morning.
Limits: the daily set changes when the bank changes (new rows reshuffle everything), so add questions between days if comparisons matter, and "the same day" follows each player's own clock. Both are fine for a casual game. General rules for seeded content are in Deterministic seeds for procedural worlds.
Other modes from the same bank
- Quick play: ten questions from a chosen category and difficulty. When a combination is thin, top it up from the nearest difficulties in the same category rather than showing a short round.
- Marathon: the whole bank in random order until three misses. The lives can carry the theme (donuts, tapes).
- Avoid repeats without a server: keep a list of recently seen question ids in
localStorage; a draw takes unseen questions first, then the ones seen longest ago.
Scoring and feel
- 100 points for a correct answer, up to 100 more for speed against a 20-second timer, plus 20 per answer of the current streak, capped at 100. The cap keeps one long streak from deciding everything.
- Offer a relaxed switch that turns the timer off for the non-daily modes. A timer is fun for some players and a reason to leave for others.
- Rank names from the subject (worst to best character, for example) cost nothing and give the final screen a punchline.
- Short Web Audio blips with a mute toggle in the header; no audio files needed.
Reskinning for a second subject
The second site was a copy of the first with a new theme, question bank, storage key and icon script; it took a fraction of the first build. The copies are independent repos, so a fix in one does not reach the other. That is acceptable for two small games; a third copy would be the point to factor the engine out.
For a fan quiz about someone else's property: draw all the art yourself (CSS shapes and generated icons), use no show artwork or logos, and say on the page that it is an unofficial fan quiz, not affiliated with the owner.
Testing a quiz without clicking through it
- Expose the game's state and helpers on one global (
window.__rewind = { dailySet, bank, state, save }). A headless script can then check that two calls for the same date return the same questions, play a round, or jump straight to the results screen for a screenshot. - A dependency-free Node script (Node 22 has
fetchandWebSocketbuilt in) can drive headless Chrome over the DevTools protocol: start Chrome with--remote-debugging-port, callEmulation.setDeviceMetricsOverridefor a true 390 px phone viewport, evaluate a snippet, capture a screenshot, and print console errors and failed requests. See Headless Chrome testing gotchas.
Gotchas
- Static files are cached hard by phones. Add a
?v=number to the script and stylesheet URLs and bump it whenever they change, or players keep yesterday's bank (see Caching static sites and unbundled ES modules (?v= stamps, no-cache, prefetch)). - Scores live on one device. Without a backend there is no leaderboard, and clearing site data erases the streak. Say so rather than implying otherwise.
- Version the storage key (
rewind.v1) so a later format change can migrate or start fresh.