If you have ever clicked a "free 3-minute personality test," answered 40 questions, and hit an email wall right before the result screen, you already know what is broken with most quiz sites on the web.

Even the ones that skip the paywall usually share two quieter design flaws:

  1. Opaque scoring: You get a single dramatic label ("You are 82% Wrath!") with zero explanation of how the number was calculated or what happened to the other dimensions.
  2. Hidden ties: If two traits score identically, most quiz apps quietly pick whichever one comes first in an array, flattening what is often the most interesting part of the profile.

When I built Vicefolk — a 21-question, browser-only 7 Deadly Sins self-reflection quiz — I decided to treat the scoring engine like a tiny open-source spec instead of a black box.

Here is how the math, the zero-backend friend-compare mode, and the client-side Canvas card exporter work under the hood.

1. Transparent Linear Math (No Secret Weights)

The test uses 21 everyday behavioral statements — exactly 3 per dimension (pride, greed, lust, envy, gluttony, wrath, sloth), interleaved so respondents aren't answering three Pride statements in a row.

Each item uses a 5-point Likert scale (1 = Strongly disagree to 5 = Strongly agree). Every dimension is scored independently on a straight linear 0–100% scale:

const ORDER = ['pride', 'greed', 'lust', 'envy', 'gluttony', 'wrath', 'sloth']; function calculate(answers, questions) { const by = Object.fromEntries(ORDER.map(k => [k, []])); for (const q of questions) { const n = answers[q.id]; by[q.dimension].push(q.reverse ? 6 - n : n); } const scores = {}; for (const key of ORDER) { const mean = by[key].reduce((a, b) => a + b, 0) / 3; scores[key] = Math.round((mean - 1) * 25); } const ranking = [...ORDER].sort((a, b) => scores[b] - scores[a]); const top = scores[ranking[0]]; return { dominant: ranking[0], ties: ranking.filter(k => scores[k] === top), ranking, scores }; } 

Because each vice is an independent average of 3 integers (1..5), the possible scores sit cleanly on a 13-step grid (0, 8, 17, 25, 33, 42, 50, 58, 67, 75, 83, 92, 100).

We published the complete specification and test vectors under MIT on GitHub (seven-deadly-sins-scoring-spec) and wrote a plain-English results & tie-decoding guide explaining why multi-vice ties (like Pride 75% + Sloth 75%) happen frequently and shouldn't be swept under the rug.

We also label the whole project upfront as entertainment and self-reflection only — never clinical diagnosis.

2. Side-by-Side Friend Comparison With Zero Database

Friends love comparing personality scores, which is normally the exact moment a quiz app forces both people to create an account and store their answers in a database.

Instead, we built Test With Friends around a tiny, strictly validated URL fragment (location.hash):

// Strictly seven integers 0..100 in fixed dimension order — never arbitrary text. function encodeCompare(scores) { return ORDER.map(key => scores[key]).join('.'); } function decodeCompare(value) { if (typeof value !== 'string' || !/^(?:\d{1,3}\.){6}\d{1,3}$/.test(value)) return null; const nums = value.split('.').map(Number); if (!nums.every(n => Number.isInteger(n) && n >= 0 && n <= 100)) return null; return Object.fromEntries(ORDER.map((key, i) => [key, nums[i]])); } 

Why #compare=83.42.50.67.58.75.83 instead of a query string ?compare=...?

  • URL fragments are never sent to the server in HTTP requests, server logs, or Referer headers.
  • There is no database, no user table, and no PII to leak or moderate.
  • The strict regex guarantees the hash can only ever represent seven bounded integers — zero XSS or spoofed-text surface.
  • Friends only generate the compare link if they explicitly check an opt-in box; default sharing only passes the leading vice type (/challenge/pride/).

3. Exporting Print-Style 4:5 and 9:16 Result Cards on Client Canvas

Most people share personality results as screenshots in group chats or Stories. Rather than spinning up a headless Puppeteer worker just to render result cards, the browser draws both a 1080×1350 (4:5) folio card and a 1080×1920 (9:16) Story card locally on <canvas> after awaiting document.fonts.ready.

One subtle production bug we hit early: serving engraving illustrations from an image CDN without permissive CORS headers taints the canvas and causes canvas.toBlob() to throw a SecurityError at export time.

The fix was a tiny same-origin resolver that rewrites cross-origin asset paths to the site's same-origin /_a/ proxy first, falling back to img.crossOrigin = 'anonymous' only if needed, and caching Promise<HTMLImageElement> in a Map so switching card variants stays instant.

What Surprised Me After Launching

  • People care way more about exact ties than I expected. Once you stop forcing a single caricature label, combinations like Pride + Sloth ("high internal standards colliding with fear of starting") spark much better conversations than a single-word verdict.
  • Zero-friction beats every growth hack. Dropping accounts, cookies, and email walls didn't hurt sharing — it made people comfortable dropping a compare link straight into a Slack channel or group chat.

If you want to inspect the scoring behavior or test-drive the 3-minute quiz yourself:

Curious how other indie devs handle shareable state without spinning up user accounts — are you using URL hashes, localStorage, or short-lived KV links?