{
  "schemaVersion": 1,
  "slug": "race-time-predictor-calculator",
  "category": "sports",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "6d642262019f27d925a1feb598a7b3b226d18fdf4429b8f33293252b6a43f57a",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/race-time-predictor-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": "T(d) = T₀ × (d ÷ d₀)^p",
    "vars": [
      [
        "T₀",
        "Known time (min)"
      ],
      [
        "d₀",
        "Known distance (km)"
      ],
      [
        "d",
        "Target distance (km)"
      ],
      [
        "p",
        "Fatigue exponent"
      ],
      [
        "T",
        "Predicted time"
      ]
    ],
    "note": "Applied to d = 5, 10, 21.0975 (half marathon), 42.195 (marathon); shown as h:mm:ss. Default p = 1.06 (Riegel-style)."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const known=knownHours*60+knownMinutes; if(knownDistance<=0||known<=0)return {__error:'inputError',time5k:null,time10k:null,timeHalf:null,timeMarathon:null,note:null}; const fmt=min=>{if(!Number.isFinite(min)||min<=0)return '—';const total=Math.round(min*60),h=Math.floor(total/3600),m=Math.floor((total%3600)/60),s=total%60;return (h>0?h+':'+String(m).padStart(2,'0'):m)+':'+String(s).padStart(2,'0');}; const predict=d=>known*Math.pow(d/knownDistance,exponent); return {time5k:fmt(predict(5)),time10k:fmt(predict(10)),timeHalf:fmt(predict(21.0975)),timeMarathon:fmt(predict(42.195)),note:'Predictions are most reliable between a 5 km and a half marathon — a marathon needs distance-specific training'};",
    "inputs": [
      {
        "name": "knownDistance",
        "type": "number",
        "default": 10,
        "min": 0.4,
        "max": 200,
        "step": 0.1,
        "slider": true
      },
      {
        "name": "knownHours",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 48,
        "step": 1,
        "slider": true
      },
      {
        "name": "knownMinutes",
        "type": "number",
        "default": 45,
        "min": 0,
        "max": 59,
        "step": 1,
        "slider": true
      },
      {
        "name": "exponent",
        "type": "number",
        "default": 1.06,
        "min": 1,
        "max": 1.25,
        "step": 0.01,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "time5k",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "time10k",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "timeHalf",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "timeMarathon",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "note",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
