{
  "schemaVersion": 1,
  "slug": "tablecloth-size-calculator",
  "category": "party",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "5bf6fe173644a47bef6405ee679f7a6c22dba9a367ef9c3abf283d98ec400e17",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/tablecloth-size-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": "C = T + 2D",
    "vars": [
      [
        "T",
        "Table length or diameter (in)"
      ],
      [
        "D",
        "Drop on each side (in)"
      ],
      [
        "C",
        "Cloth length or diameter (in)"
      ]
    ],
    "note": "Required cloth dimension = corresponding table dimension + 2 × desired drop. The size label rounds each required dimension up to an even inch; drop-style thresholds (<8, <15, <26 inches) are rough labels, not a universal standard."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const d = drop*2; const cl = shape === 'round' ? diameter + d : shape === 'square' ? length + d : length + d; const cw = shape === 'round' ? diameter + d : width + d; const style = drop < 8 ? 'Short / lap length' : drop < 15 ? 'Standard banquet drop' : drop < 26 ? 'Floor length' : 'Puddle length'; return { clothLength: cl, clothWidth: cw, clothDiameter: shape === 'round' ? diameter + d : 0, dropStyle: style, sizeLabel: shape === 'round' ? Math.ceil((diameter + d)/2)*2 + ' in round' : Math.ceil(cl/2)*2 + ' x ' + Math.ceil(cw/2)*2 + ' in' };",
    "inputs": [
      {
        "name": "shape",
        "type": "select",
        "default": "round",
        "options": [
          {
            "value": "round"
          },
          {
            "value": "square"
          },
          {
            "value": "rect"
          }
        ]
      },
      {
        "name": "diameter",
        "type": "number",
        "default": 60,
        "min": 20,
        "max": 120,
        "step": 1,
        "slider": true
      },
      {
        "name": "length",
        "type": "number",
        "default": 72,
        "min": 20,
        "max": 200,
        "step": 1,
        "slider": true
      },
      {
        "name": "width",
        "type": "number",
        "default": 36,
        "min": 20,
        "max": 120,
        "step": 1,
        "slider": true
      },
      {
        "name": "drop",
        "type": "number",
        "default": 10,
        "min": 0,
        "max": 40,
        "step": 1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "clothLength",
        "precision": 0,
        "unit": "in"
      },
      {
        "name": "clothWidth",
        "precision": 0,
        "unit": "in"
      },
      {
        "name": "clothDiameter",
        "precision": 0,
        "unit": "in"
      },
      {
        "name": "dropStyle",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "sizeLabel",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
