{
  "schemaVersion": 1,
  "slug": "balloon-calculator",
  "category": "party",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "5f5e778da5d903690d7515d46cde06b6040088d67f7350a3afda642bb4b35add",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/balloon-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": "v = 0.5 × (s ÷ 11)³; N = ⌊V ÷ v⌋",
    "vars": [
      [
        "s",
        "Balloon size, in"
      ],
      [
        "v",
        "Helium per balloon, ft³"
      ],
      [
        "V",
        "Tank capacity, ft³"
      ],
      [
        "N",
        "Balloons per tank"
      ]
    ],
    "note": "An 11-inch balloon needs 0.5 ft³ as the baseline; tank capacity and per-balloon volume use the same units."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const helium = 0.5*Math.pow(balloonSize/11, 3); const filled = helium > 0 ? Math.floor(tankSize/helium) : 0; const packs = Math.ceil(filled/balloonsPerPack); const total = tankCost + packs*packCost; return { heliumPerBalloon: helium, balloonsPerTank: filled, costPerBalloon: filled > 0 ? total/filled : 0, packsNeeded: packs, totalCost: total };",
    "inputs": [
      {
        "name": "tankSize",
        "type": "select",
        "default": 14.9,
        "options": [
          {
            "value": 8.9
          },
          {
            "value": 14.9
          },
          {
            "value": 55
          },
          {
            "value": 291
          }
        ]
      },
      {
        "name": "balloonSize",
        "type": "select",
        "default": 11,
        "options": [
          {
            "value": 5
          },
          {
            "value": 9
          },
          {
            "value": 11
          },
          {
            "value": 12
          },
          {
            "value": 16
          }
        ]
      },
      {
        "name": "tankCost",
        "type": "number",
        "default": 45,
        "min": 0,
        "max": 5000,
        "step": 0.01
      },
      {
        "name": "balloonsPerPack",
        "type": "number",
        "default": 50,
        "min": 1,
        "max": 1000,
        "step": 1,
        "slider": true
      },
      {
        "name": "packCost",
        "type": "number",
        "default": 12,
        "min": 0,
        "max": 1000,
        "step": 0.01
      }
    ],
    "outputs": [
      {
        "name": "balloonsPerTank",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "totalCost",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "heliumPerBalloon",
        "precision": 3,
        "unit": "cu ft"
      },
      {
        "name": "costPerBalloon",
        "precision": 3,
        "unit": "$"
      },
      {
        "name": "packsNeeded",
        "precision": 0,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
