{
  "schemaVersion": 1,
  "slug": "brick-calculator",
  "category": "construction",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "ac08a879f7a3b7ca66adbc6d433dc5b486080cf91a9ba03676c0fcc5ccfbf318",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/brick-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 = ⌈A × d × (1 + w ÷ 100)⌉;  A = max(0, L × H − A₀)",
    "vars": [
      [
        "N",
        "Bricks needed (rounded up)"
      ],
      [
        "A",
        "Net wall area, sq ft"
      ],
      [
        "d",
        "Bricks per sq ft by brick type"
      ],
      [
        "w",
        "Waste allowance, %"
      ],
      [
        "L",
        "Wall length, ft"
      ],
      [
        "H",
        "Wall height, ft"
      ],
      [
        "A₀",
        "Area of doors and windows subtracted, sq ft"
      ]
    ],
    "note": "Estimated units = ceil((wall length × height − openings) × units per sq ft × (1 + waste/100)). Typical face coverage assumptions: modular 6.5, queen 5.5, king 4.5, nominal 8 in block 1.125 and nominal 12 in block 1.125 per sq ft. Both block sizes assume a 7 5/8 × 15 5/8 in face; verify actual product dimensions and bond."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const D = { modular:6.5, queen:5.5, king:4.5, block8:1.125, block12:1.125 }; const perSqft = D[brickType] || 6.5; const wallArea = Math.max(0, length*height-openingArea); const bricks = Math.ceil(wallArea*perSqft*(1+waste/100)); return { wallArea, unitsPerSqft: perSqft, bricks, cost: bricks*pricePerUnit };",
    "inputs": [
      {
        "name": "length",
        "type": "number",
        "default": 20,
        "min": 0,
        "max": 1000,
        "step": 0.25,
        "slider": true
      },
      {
        "name": "height",
        "type": "number",
        "default": 8,
        "min": 0,
        "max": 100,
        "step": 0.25,
        "slider": true
      },
      {
        "name": "brickType",
        "type": "select",
        "default": "modular",
        "options": [
          {
            "value": "modular"
          },
          {
            "value": "queen"
          },
          {
            "value": "king"
          },
          {
            "value": "block8"
          },
          {
            "value": "block12"
          }
        ]
      },
      {
        "name": "openingArea",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 5000,
        "step": 1,
        "slider": true
      },
      {
        "name": "waste",
        "type": "number",
        "default": 7,
        "min": 0,
        "max": 30,
        "step": 1,
        "slider": true
      },
      {
        "name": "pricePerUnit",
        "type": "number",
        "default": 0.6,
        "min": 0,
        "max": 50,
        "step": 0.01,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "wallArea",
        "precision": 1,
        "unit": "sq ft"
      },
      {
        "name": "unitsPerSqft",
        "precision": 2,
        "unit": ""
      },
      {
        "name": "bricks",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "cost",
        "precision": 2,
        "unit": "$"
      }
    ],
    "interpret": null
  }
}
