{
  "schemaVersion": 1,
  "slug": "how-many-tables-calculator",
  "category": "party",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "51ef2d4dcb86c1a5bb5b81a338d14797adb882060315a2de3ca6453c66a96635",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/how-many-tables-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 = ⌈G ÷ s⌉ ; chairs = T × (s + p) ; Textra = ⌈G ÷ (s + p)⌉",
    "vars": [
      [
        "G",
        "guests"
      ],
      [
        "s",
        "actual seats per table"
      ],
      [
        "p",
        "extra chairs per table"
      ]
    ],
    "note": "T = ceil(G/s) at the venue’s stated capacity; chairs = T × (s+p); Textra = ceil(G/(s+p)) only if the extra chairs fit safely. These are two layout scenarios."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const t=Math.ceil(guests/seatsPerTable); const cap=seatsPerTable+spareSeats; return {tables:t,chairs:t*cap,tablesWithSpare:Math.ceil(guests/cap)};",
    "inputs": [
      {
        "name": "guests",
        "type": "number",
        "default": 80,
        "min": 1,
        "max": 2000,
        "step": 1,
        "slider": true
      },
      {
        "name": "seatsPerTable",
        "type": "number",
        "default": 8,
        "min": 2,
        "max": 20,
        "step": 1,
        "slider": true
      },
      {
        "name": "spareSeats",
        "type": "number",
        "default": 1,
        "min": 0,
        "max": 4,
        "step": 1
      }
    ],
    "outputs": [
      {
        "name": "tables",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "chairs",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "tablesWithSpare",
        "precision": 0,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
