{
  "schemaVersion": 1,
  "slug": "paint-room-calculator",
  "category": "construction",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "d4791263c08713bf4a2b3fe6fc4a38fafb7e52a280f940b2305a4b4d43e29cff",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/paint-room-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 = max(0, 2 H (L + W) + c L W − 20 D − 15 N); G = A × K ÷ R; cans = ceil(G)",
    "vars": [
      [
        "L",
        "Room length (ft)"
      ],
      [
        "W",
        "Room width (ft)"
      ],
      [
        "H",
        "Wall height (ft)"
      ],
      [
        "D,N",
        "Numbers of doors and windows"
      ],
      [
        "K",
        "Number of coats"
      ],
      [
        "c,R",
        "Ceiling flag (1 included, 0 not); coverage (sq ft/gallon, default 350)"
      ]
    ],
    "note": "Wall area = 2(length + width) × height; optional ceiling = length × width; modeled openings subtract 20 sq ft per door and 15 per window. Rejects opening estimates exceeding modeled surface area; actual opening sizes and surface conditions vary."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const wallArea=(length+width)*2*height,ceilingArea=includeCeiling==='yes'?length*width:0,openings=doors*20+windows*15,surface=wallArea+ceilingArea;if(openings>surface)return{wallArea,ceilingArea,paintableArea:null,gallons:null,cans:null,__error:'inputError'};const paintableArea=surface-openings,gallons=paintableArea*coats/(coverage||350);return{wallArea,ceilingArea,paintableArea,gallons,cans:Math.ceil(gallons)};",
    "inputs": [
      {
        "name": "length",
        "type": "number",
        "default": 14,
        "min": 0,
        "max": 500,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "width",
        "type": "number",
        "default": 12,
        "min": 0,
        "max": 500,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "height",
        "type": "number",
        "default": 8,
        "min": 4,
        "max": 30,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "doors",
        "type": "number",
        "default": 2,
        "min": 0,
        "max": 50,
        "step": 1,
        "slider": true
      },
      {
        "name": "windows",
        "type": "number",
        "default": 2,
        "min": 0,
        "max": 50,
        "step": 1,
        "slider": true
      },
      {
        "name": "coats",
        "type": "number",
        "default": 2,
        "min": 1,
        "max": 5,
        "step": 1
      },
      {
        "name": "includeCeiling",
        "type": "select",
        "default": "no",
        "options": [
          {
            "value": "no"
          },
          {
            "value": "yes"
          }
        ]
      },
      {
        "name": "coverage",
        "type": "number",
        "default": 350,
        "min": 50,
        "max": 800,
        "step": 10,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "wallArea",
        "precision": 1,
        "unit": "sq ft"
      },
      {
        "name": "ceilingArea",
        "precision": 1,
        "unit": "sq ft"
      },
      {
        "name": "paintableArea",
        "precision": 1,
        "unit": "sq ft"
      },
      {
        "name": "gallons",
        "precision": 2,
        "unit": "gal"
      },
      {
        "name": "cans",
        "precision": 0,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
