{
  "schemaVersion": 1,
  "slug": "deck-calculator",
  "category": "construction",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "293bab3a9126c450acf7af6391ac2c35b3cb91e6a8c47c8e1c0790bccb0071e3",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/deck-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": "A = LW; B = ⌈⌈12s ÷ (w + 0.25)⌉ × ⌈r ÷ 16⌉ × (1 + q ÷ 100)⌉",
    "vars": [
      [
        "A",
        "Area (sq ft)"
      ],
      [
        "L",
        "Length (ft)"
      ],
      [
        "W",
        "Width (ft)"
      ],
      [
        "s",
        "Span (ft)"
      ],
      [
        "r",
        "Run (ft)"
      ],
      [
        "w",
        "Board width (in)"
      ],
      [
        "q",
        "Waste percent"
      ],
      [
        "B",
        "Boards needed"
      ]
    ],
    "note": "Board count = ceil(ceil(span × 12 / (board width + 0.25 in)) × ceil(run / 16 ft) × (1 + waste/100)). Assumes 16 ft boards, a 1/4 in gap and no offcut reuse; this estimate does not size the supporting structure."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const area = length*width; const spanFeet = boardDirection === 'across' ? length : width; const runFeet = boardDirection === 'across' ? width : length; const boardsAcross = Math.ceil(spanFeet*12/(boardWidth+0.25)); const boardsPerRow = Math.ceil(runFeet/16); const boards = Math.ceil(boardsAcross*boardsPerRow*(1+waste/100)); return { area, boards };",
    "inputs": [
      {
        "name": "length",
        "type": "number",
        "default": 16,
        "min": 1,
        "max": 200,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "width",
        "type": "number",
        "default": 12,
        "min": 1,
        "max": 200,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "boardWidth",
        "type": "number",
        "default": 5.5,
        "min": 2,
        "max": 12,
        "step": 0.25,
        "slider": true
      },
      {
        "name": "boardDirection",
        "type": "select",
        "default": "across",
        "options": [
          {
            "value": "across"
          },
          {
            "value": "along"
          }
        ]
      },
      {
        "name": "waste",
        "type": "number",
        "default": 10,
        "min": 0,
        "max": 30,
        "step": 1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "area",
        "precision": 1,
        "unit": "sq ft"
      },
      {
        "name": "boards",
        "precision": 0,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
