{
  "schemaVersion": 1,
  "slug": "wedding-alcohol-calculator",
  "category": "party",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "a5f29ceda27b76d89ff54ce3f408c9a32211bc2277c62e98c0b476cd53feaf54",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/wedding-alcohol-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": "D = G × p ÷ 100 × (1 + 0.9 × max(0, H − 1))",
    "vars": [
      [
        "G",
        "Guests"
      ],
      [
        "p",
        "Drinkers (%)"
      ],
      [
        "H",
        "Duration (hours)"
      ],
      [
        "D",
        "Total drinks"
      ]
    ],
    "note": "Per drinking guest: 1 drink in hour one, then 0.9 per additional hour. Shares with spirits: beer/wine/spirits 35/35/30%; without spirits: 55/45/0%. Assumes 5 wine servings and 16 spirit servings per bottle, one champagne bottle per 8 drinkers and 1.25 lb ice per guest. Purchase counts round up independently; all factors are planning assumptions, not consumption guidance."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const perGuest = 1 + Math.max(0, hours - 1)*0.9; const drinkers = guests*drinkerPct/100; const total = drinkers*perGuest; const beerShare = spirits === 'yes' ? 0.35 : 0.55; const wineShare = spirits === 'yes' ? 0.35 : 0.45; const spiritShare = spirits === 'yes' ? 0.3 : 0; return { totalDrinks: Math.ceil(total), beerBottles: Math.ceil(total*beerShare), wineBottles: Math.ceil(total*wineShare/5), liquorBottles: Math.ceil(total*spiritShare/16), champagneBottles: Math.ceil(drinkers/8), iceLb: guests*1.25, drinksPerGuest: drinkers > 0 ? total/drinkers : null };",
    "inputs": [
      {
        "name": "guests",
        "type": "number",
        "default": 100,
        "min": 1,
        "max": 2000,
        "step": 1,
        "slider": true
      },
      {
        "name": "hours",
        "type": "number",
        "default": 5,
        "min": 1,
        "max": 14,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "drinkerPct",
        "type": "number",
        "default": 70,
        "min": 0,
        "max": 100,
        "step": 1,
        "slider": true
      },
      {
        "name": "spirits",
        "type": "select",
        "default": "yes",
        "options": [
          {
            "value": "yes"
          },
          {
            "value": "no"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "totalDrinks",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "beerBottles",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "wineBottles",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "liquorBottles",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "champagneBottles",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "iceLb",
        "precision": 1,
        "unit": "lb"
      },
      {
        "name": "drinksPerGuest",
        "precision": 1,
        "unit": "",
        "optional": true
      }
    ],
    "interpret": null
  }
}
