{
  "schemaVersion": 1,
  "slug": "quilt-calculator",
  "category": "diy-craft",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "2ade4b99941da705276533a579e7ee9e6019096a735c91bdcbd17f02ac0db8fa",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/quilt-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": "n = ⌈W÷s⌉×⌈L÷s⌉; Y = W×L÷(F×36)×1.25; Yb = ⌈2(W+L)÷F⌉×Bw÷36",
    "vars": [
      [
        "W",
        "Quilt width (in)"
      ],
      [
        "L",
        "Quilt length (in)"
      ],
      [
        "s",
        "Finished block size (in)"
      ],
      [
        "F",
        "Fabric width (in)"
      ],
      [
        "n",
        "Total blocks"
      ],
      [
        "Y",
        "Top fabric (yd)"
      ],
      [
        "Yb",
        "Binding fabric (yd)"
      ],
      [
        "Bw",
        "Binding strip width (in)"
      ]
    ],
    "note": "Blocks across/down = ceiling(finished dimension / block size); cut size adds twice the seam allowance. Fabric estimates use fixed 25% top and 10% backing allowances; layout, borders, directional prints, shrinkage and cutting plans can change yardage."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const across = Math.max(1, Math.ceil(quiltWidth/blockSize)); const down = Math.max(1, Math.ceil(quiltLength/blockSize)); const blocks = across*down; const cut = blockSize + seamAllowance*2; const topArea = quiltWidth*quiltLength; const fabricYards = topArea/(fabricWidth*36)*1.25; const perimeter = 2*(quiltWidth + quiltLength); const bindingStrips = Math.ceil(perimeter/fabricWidth); const bindingYards = bindingStrips*bindingWidth/36; const backingYards = topArea/(fabricWidth*36)*1.1; return { blocksAcross: across, blocksDown: down, totalBlocks: blocks, cutBlockSize: cut, fabricYards: fabricYards, bindingYards: bindingYards, backingYards: backingYards };",
    "inputs": [
      {
        "name": "quiltWidth",
        "type": "number",
        "default": 60,
        "min": 10,
        "max": 200,
        "step": 1,
        "slider": true
      },
      {
        "name": "quiltLength",
        "type": "number",
        "default": 80,
        "min": 10,
        "max": 200,
        "step": 1,
        "slider": true
      },
      {
        "name": "blockSize",
        "type": "number",
        "default": 10,
        "min": 2,
        "max": 40,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "seamAllowance",
        "type": "number",
        "default": 0.25,
        "min": 0,
        "max": 1,
        "step": 0.25
      },
      {
        "name": "fabricWidth",
        "type": "number",
        "default": 44,
        "min": 20,
        "max": 120,
        "step": 1,
        "slider": true
      },
      {
        "name": "bindingWidth",
        "type": "number",
        "default": 2.5,
        "min": 1,
        "max": 6,
        "step": 0.5,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "blocksAcross",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "blocksDown",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "totalBlocks",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "cutBlockSize",
        "precision": 2,
        "unit": "in"
      },
      {
        "name": "fabricYards",
        "precision": 2,
        "unit": "yards"
      },
      {
        "name": "bindingYards",
        "precision": 2,
        "unit": "yards"
      },
      {
        "name": "backingYards",
        "precision": 2,
        "unit": "yards"
      }
    ],
    "interpret": null
  }
}
