module.exports = { slug: "cooking-time-scaling-by-weight", title: "Cooking time scaling by weight", deck_category: "cooking", description: "Estimates total cooking time from item weight using a stated minutes-per-unit-weight rule of thumb plus a fixed base time, both supplied as inputs.", inputs: [ { name: "weight", type: "number", required: true, description: "Weight of the item to cook", min: 0 }, { name: "weight_unit", type: "string", required: true, description: "Unit the minutes_per_unit_weight rule is stated in", min: 1 }, { name: "minutes_per_unit_weight", type: "number", unit: "minutes per weight_unit", required: true, description: "Stated rule-of-thumb cooking minutes per unit of weight, e.g. from a recipe or cookbook", min: 0 }, { name: "base_minutes", type: "number", unit: "minutes", required: false, description: "Optional fixed additional time, e.g. a resting or browning allowance", min: 0 } ], outputs: [ { name: "total_minutes", unit: "minutes", description: "Estimated total cooking time" } ], steps: [ "This card applies whatever rule of thumb is supplied; it does not assume a specific food or oven temperature.", "variable_time = weight * minutes_per_unit_weight.", "total_minutes = variable_time + base_minutes (base_minutes defaults to 0 if not given).", "Round the result to the nearest whole minute." ], constants: [], sources: [ { kind: "edition_page", value: "Standard 'time per unit weight plus a fixed allowance' cooking-time estimation method (e.g. roasting-time rules of thumb expressed as minutes per pound or per kilogram plus a base time)", title: "General cooking-time-by-weight scaling method", publisher: "Standard culinary reference practice (e.g. The Joy of Cooking, roasting time tables)", retrieved_utc: "2026-09-30T20:15:00Z", note: "The minutes-per-unit-weight figure and any base time are supplied as inputs by the person asking, never baked into this card, since these rules vary by food, cut, and oven." } ], disclaimer: null, questionText(inputs) { const basePart = (inputs.base_minutes !== undefined && inputs.base_minutes !== null && inputs.base_minutes !== 0) ? ` plus a base time of ${inputs.base_minutes} minutes` : ""; return `Using a rule of thumb of ${inputs.minutes_per_unit_weight} minutes per ${inputs.weight_unit}${basePart}, how long should ${inputs.weight} ${inputs.weight_unit} take to cook?`; }, run(inputs) { const { weight, minutes_per_unit_weight, base_minutes } = inputs; if (typeof weight !== "number" || weight <= 0) throw new Error("weight must be a positive number"); if (typeof minutes_per_unit_weight !== "number" || minutes_per_unit_weight < 0) throw new Error("minutes_per_unit_weight must be a non-negative number"); let base = 0; if (base_minutes !== undefined && base_minutes !== null) { if (typeof base_minutes !== "number" || base_minutes < 0) throw new Error("base_minutes must be a non-negative number if provided"); base = base_minutes; } const variableTime = weight * minutes_per_unit_weight; const totalRaw = variableTime + base; const total = Math.round(totalRaw); return { answer: `${total} minutes`, values: { total_minutes: total } }; }, examples: [ { name: "worked example", inputs: { weight: 5, weight_unit: "lb", minutes_per_unit_weight: 20, base_minutes: 15 }, expected: { answer: "115 minutes" }, check: "5*20 = 100 variable minutes; 100 + 15 base = 115." }, { name: "test vector: no base time", inputs: { weight: 2.5, weight_unit: "kg", minutes_per_unit_weight: 40 }, expected: { answer: "100 minutes" }, check: "2.5*40 = 100 variable minutes; base_minutes not given so treated as 0; total = 100." } ] };