{
  "schemaVersion": 1,
  "slug": "spirit-animal-quiz-calculator",
  "category": "fun",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "3f40f7b32d0c39691a31bebdb74aebb58b5343e74e406d169d20f1526e93a71d",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/spirit-animal-quiz-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": "animal = A[m], element = E[m]; m = month(birthDate), 1 ≤ m ≤ 12",
    "vars": [
      [
        "birthDate",
        "Date of birth"
      ],
      [
        "element",
        "Chosen element"
      ],
      [
        "A",
        "Animal table"
      ],
      [
        "E",
        "Native-element table"
      ]
    ],
    "note": "The birth month maps to a fixed symbolic animal and element; optional element selection changes only the displayed element. Entertainment only."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const table = ['Wolf', 'Otter', 'Falcon', 'Bear', 'Deer', 'Fox', 'Horse', 'Salmon', 'Owl', 'Raven', 'Badger', 'Elk']; const elTable = ['Air', 'Water', 'Air', 'Earth', 'Earth', 'Fire', 'Fire', 'Water', 'Air', 'Air', 'Earth', 'Earth']; const traits = { Wolf: 'Loyal, intuitive, protective', Otter: 'Playful, curious, social', Falcon: 'Focused, decisive, far-seeing', Bear: 'Grounded, strong, patient', Deer: 'Gentle, alert, quick', Fox: 'Clever, adaptable, strategic', Horse: 'Free, driven, energetic', Salmon: 'Determined, cyclical, resilient', Owl: 'Wise, observant, quiet', Raven: 'Inventive, perceptive, bold', Badger: 'Tenacious, self-reliant, steady', Elk: 'Noble, enduring, proud' }; const validDate = (s) => { const m = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(String(s)); if (!m) return false; const d = new Date(String(s) + 'T00:00:00Z'); return Number.isFinite(d.getTime()) && d.getUTCFullYear() === +m[1] && d.getUTCMonth()+1 === +m[2] && d.getUTCDate() === +m[3]; };\nif (!validDate(birthDate)) return { animal: null, traits: null, element: null, month: null, __error: 'inputError' };\nconst bd = new Date(birthDate + 'T00:00:00Z'); const m = bd.getUTCMonth(); const animal = table[m]; const natEl = elTable[m]; const el = element === 'any' ? natEl : element; return { animal: animal, traits: traits[animal], element: el, month: m + 1 };",
    "inputs": [
      {
        "name": "birthDate",
        "type": "date",
        "default": "1990-06-15",
        "step": 1
      },
      {
        "name": "element",
        "type": "select",
        "default": "any",
        "options": [
          {
            "value": "any"
          },
          {
            "value": "fire"
          },
          {
            "value": "water"
          },
          {
            "value": "earth"
          },
          {
            "value": "air"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "animal",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "traits",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "element",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "month",
        "precision": 0,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
