{
  "schemaVersion": 1,
  "slug": "trivia-score-calculator",
  "category": "fun",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "d58bf0535fcfab13d2ac53d9f60d69c6a9bdbf577ebb4edc64a45ba912aea20e",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/trivia-score-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "S = c×p − w×q + b; A = 100c/(c+w) when c+w>0, otherwise undefined",
    "vars": [
      [
        "c,w",
        "Correct and incorrect answers"
      ],
      [
        "p,q",
        "Points per correct and penalty per incorrect answer"
      ],
      [
        "b",
        "Bonus points"
      ],
      [
        "S",
        "Score"
      ],
      [
        "A",
        "Accuracy (%)"
      ]
    ],
    "note": "Accuracy is undefined when no questions are entered. Scores use only the user-supplied point, penalty and bonus values; no performance rating is assigned."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "OpenStax — Percent and weighted arithmetic",
        "url": "https://openstax.org/books/prealgebra-2e/pages/6-1-understand-percent"
      }
    ],
    "referenceRole": "definition",
    "implementationHash": "d58bf0535fcfab13d2ac53d9f60d69c6a9bdbf577ebb4edc64a45ba912aea20e",
    "basis": "S = c×p − w×q + b; A = 100c/(c+w) when c+w>0, otherwise undefined",
    "limitations": "The references explain definitions and methods; any extra preset must be checked against the assumptions on this page."
  },
  "contract": {
    "compute": "const base=correct*pointsPerCorrect;const pen=incorrect*penaltyPerWrong;const total=correct+incorrect;const acc=total>0?correct/total*100:null;return {score:base-pen+bonus,basePoints:base,penalties:pen,accuracy:acc,totalQuestions:total};",
    "inputs": [
      {
        "name": "correct",
        "type": "number",
        "default": 15,
        "min": 0,
        "max": 10000,
        "step": 1
      },
      {
        "name": "incorrect",
        "type": "number",
        "default": 5,
        "min": 0,
        "max": 10000,
        "step": 1
      },
      {
        "name": "pointsPerCorrect",
        "type": "number",
        "default": 2,
        "min": 0,
        "max": 1000,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "penaltyPerWrong",
        "type": "number",
        "default": 0.5,
        "min": 0,
        "max": 1000,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "bonus",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 10000,
        "step": 1
      }
    ],
    "outputs": [
      {
        "name": "score",
        "precision": 2,
        "unit": ""
      },
      {
        "name": "basePoints",
        "precision": 2,
        "unit": ""
      },
      {
        "name": "penalties",
        "precision": 2,
        "unit": ""
      },
      {
        "name": "accuracy",
        "precision": 1,
        "unit": "%",
        "optional": true
      },
      {
        "name": "totalQuestions",
        "precision": 0,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
