{"abstract":"A small pinch of a rare reagent counts as much as the bulk material.","category":"Game economy crafting balance","checks":8,"contract":"materials = [[quality, weight], ...]. If total weight <= 0 the craft fails (score 0, tier \"failed\"). score = floor(sum(q*w)/sum(w)) + skill//10, capped at 100. Tier index = number of cutoffs [40, 65, 85] with score >= cutoff over [common, fine, superior, masterwork]. A critical craft (skill >= 25 and crit_roll < 5) raises the tier by one, never above masterwork.","contract_signature":"materials, skill, crit_roll","evaluation_group":"w2-game-economy-crafting-balance-craft-quality","failed_approach":"Dividing the weighted sum by the material count inflates scores whenever weights exceed one.","family":"w2-game-economy-crafting-balance-craft-quality-material-weighting","id":"FA-86051","implementations":{"attempt":{"sha256":"28e20d33060d82534b96dad1893d0900770ce08f5155b8e6013b223e81e1bf8d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(materials, skill, crit_roll):\n    tiers = ['common', 'fine', 'superior', 'masterwork']\n    cuts = [40, 65, 85]\n    total_w = sum(w for q, w in materials)\n    if total_w <= 0:\n        return {'score': 0, 'tier': 'failed'}\n    score = sum(q * w for q, w in materials) // len(materials) + skill // 10\n    score = min(100, score)\n    t = sum(1 for c in cuts if score >= c)\n    if skill >= 25 and crit_roll < 5:\n        t = min(t + 1, len(tiers) - 1)\n    return {'score': score, 'tier': tiers[t]}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),\n  ('regression material weighting #1',\n   [[[39, 1], [100, 3], [85, 1]], 26, 5],\n   {'score': 86, 'tier': 'masterwork'}),\n  ('regression material weighting #2', [[[39, 3], [85, 0]], 52, 0], {'score': 44, 'tier': 'superior'}),\n  ('regression material weighting #3',\n   [[[100, 1], [65, 3], [40, 1], [39, 1]], 99, 4],\n   {'score': 71, 'tier': 'masterwork'}),\n  ('regression material weighting #4', [[[58, 0], [40, 0], [58, 1]], 9, 0], {'score': 58, 'tier': 'fine'}),\n  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),\n  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),\n  ('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],\n [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),\n  ('regression material weighting #1', [[[39, 3], [85, 0]], 52, 0], {'score': 44, 'tier': 'superior'}),\n  ('regression material weighting #2',\n   [[[100, 1], [65, 3], [40, 1], [39, 1]], 99, 4],\n   {'score': 71, 'tier': 'masterwork'}),\n  ('regression material weighting #3', [[[58, 0], [40, 0], [58, 1]], 9, 0], {'score': 58, 'tier': 'fine'}),\n  ('regression material weighting #4', [[[0, 0], [64, 3]], 0, 0], {'score': 64, 'tier': 'fine'}),\n  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),\n  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),\n  ('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],\n [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),\n  ('regression material weighting #1', [[[58, 0], [40, 0], [58, 1]], 9, 0], {'score': 58, 'tier': 'fine'}),\n  ('regression material weighting #2', [[[0, 0], [64, 3]], 0, 0], {'score': 64, 'tier': 'fine'}),\n  ('regression material weighting #3',\n   [[[65, 1], [65, 0], [39, 1], [64, 1]], 25, 16],\n   {'score': 58, 'tier': 'fine'}),\n  ('regression material weighting #4', [[[39, 2], [0, 1], [65, 2]], 25, 5], {'score': 43, 'tier': 'fine'}),\n  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),\n  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),\n  ('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],\n [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),\n  ('regression material weighting #1',\n   [[[65, 1], [65, 0], [39, 1], [64, 1]], 25, 16],\n   {'score': 58, 'tier': 'fine'}),\n  ('regression material weighting #2', [[[39, 2], [0, 1], [65, 2]], 25, 5], {'score': 43, 'tier': 'fine'}),\n  ('regression material weighting #3',\n   [[[40, 0], [65, 0], [84, 1], [100, 0]], 17, 4],\n   {'score': 85, 'tier': 'masterwork'}),\n  ('regression material weighting #4',\n   [[[0, 1], [65, 3], [0, 0], [64, 3]], 103, 10],\n   {'score': 65, 'tier': 'superior'}),\n  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),\n  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),\n  ('control #1', [[[39, 1]], 25, 5], {'score': 41, 'tier': 'fine'})],\n [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),\n  ('regression material weighting #1',\n   [[[40, 0], [65, 0], [84, 1], [100, 0]], 17, 4],\n   {'score': 85, 'tier': 'masterwork'}),\n  ('regression material weighting #2',\n   [[[0, 1], [65, 3], [0, 0], [64, 3]], 103, 10],\n   {'score': 65, 'tier': 'superior'}),\n  ('regression material weighting #3', [[[100, 0], [40, 3]], 150, 50], {'score': 55, 'tier': 'fine'}),\n  ('partial repair boundary #1', [[[100, 0], [100, 1]], 24, 50], {'score': 100, 'tier': 'masterwork'}),\n  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),\n  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),\n  ('control #1', [[[39, 0]], 24, 28], {'score': 0, 'tier': 'failed'})]]\nfor label, args, expected in cases[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"b7cb7db4a4a83b6223b6c195c21548221aecd89a3924a70df3fc166ecd6ad65e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(materials, skill, crit_roll):\n    tiers = ['common', 'fine', 'superior', 'masterwork']\n    cuts = [40, 65, 85]\n    total_w = sum(w for q, w in materials)\n    if total_w <= 0:\n        return {'score': 0, 'tier': 'failed'}\n    score = sum(q for q, w in materials) // len(materials) + skill // 10\n    score = min(100, score)\n    t = sum(1 for c in cuts if score >= c)\n    if skill >= 25 and crit_roll < 5:\n        t = min(t + 1, len(tiers) - 1)\n    return {'score': score, 'tier': tiers[t]}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),\n  ('regression material weighting #1',\n   [[[39, 1], [100, 3], [85, 1]], 26, 5],\n   {'score': 86, 'tier': 'masterwork'}),\n  ('regression material weighting #2', [[[39, 3], [85, 0]], 52, 0], {'score': 44, 'tier': 'superior'}),\n  ('regression material weighting #3',\n   [[[100, 1], [65, 3], [40, 1], [39, 1]], 99, 4],\n   {'score': 71, 'tier': 'masterwork'}),\n  ('regression material weighting #4', [[[58, 0], [40, 0], [58, 1]], 9, 0], {'score': 58, 'tier': 'fine'}),\n  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),\n  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),\n  ('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],\n [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),\n  ('regression material weighting #1', [[[39, 3], [85, 0]], 52, 0], {'score': 44, 'tier': 'superior'}),\n  ('regression material weighting #2',\n   [[[100, 1], [65, 3], [40, 1], [39, 1]], 99, 4],\n   {'score': 71, 'tier': 'masterwork'}),\n  ('regression material weighting #3', [[[58, 0], [40, 0], [58, 1]], 9, 0], {'score': 58, 'tier': 'fine'}),\n  ('regression material weighting #4', [[[0, 0], [64, 3]], 0, 0], {'score': 64, 'tier': 'fine'}),\n  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),\n  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),\n  ('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],\n [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),\n  ('regression material weighting #1', [[[58, 0], [40, 0], [58, 1]], 9, 0], {'score': 58, 'tier': 'fine'}),\n  ('regression material weighting #2', [[[0, 0], [64, 3]], 0, 0], {'score': 64, 'tier': 'fine'}),\n  ('regression material weighting #3',\n   [[[65, 1], [65, 0], [39, 1], [64, 1]], 25, 16],\n   {'score': 58, 'tier': 'fine'}),\n  ('regression material weighting #4', [[[39, 2], [0, 1], [65, 2]], 25, 5], {'score': 43, 'tier': 'fine'}),\n  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),\n  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),\n  ('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],\n [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),\n  ('regression material weighting #1',\n   [[[65, 1], [65, 0], [39, 1], [64, 1]], 25, 16],\n   {'score': 58, 'tier': 'fine'}),\n  ('regression material weighting #2', [[[39, 2], [0, 1], [65, 2]], 25, 5], {'score': 43, 'tier': 'fine'}),\n  ('regression material weighting #3',\n   [[[40, 0], [65, 0], [84, 1], [100, 0]], 17, 4],\n   {'score': 85, 'tier': 'masterwork'}),\n  ('regression material weighting #4',\n   [[[0, 1], [65, 3], [0, 0], [64, 3]], 103, 10],\n   {'score': 65, 'tier': 'superior'}),\n  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),\n  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),\n  ('control #1', [[[39, 1]], 25, 5], {'score': 41, 'tier': 'fine'})],\n [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),\n  ('regression material weighting #1',\n   [[[40, 0], [65, 0], [84, 1], [100, 0]], 17, 4],\n   {'score': 85, 'tier': 'masterwork'}),\n  ('regression material weighting #2',\n   [[[0, 1], [65, 3], [0, 0], [64, 3]], 103, 10],\n   {'score': 65, 'tier': 'superior'}),\n  ('regression material weighting #3', [[[100, 0], [40, 3]], 150, 50], {'score': 55, 'tier': 'fine'}),\n  ('partial repair boundary #1', [[[100, 0], [100, 1]], 24, 50], {'score': 100, 'tier': 'masterwork'}),\n  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),\n  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),\n  ('control #1', [[[39, 0]], 24, 28], {'score': 0, 'tier': 'failed'})]]\nfor label, args, expected in cases[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"Deterministic toy contract stipulated for this model; integer or exact arithmetic only, not a reproduction of any specific game engine. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-game-economy-crafting-balance-craft-quality-material-weighting","generated_at":"2026-09-29T14:50:46.086151+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Game economies leak or destroy currency when one crafting or pricing rule is off by one boundary, rounding stage or state update; the defect is observable in exact integer outcomes.","root_cause":"Quality is a plain mean of material qualities instead of the weighted mean.","sha256":"9ff8098eca2fda0b8ed3b3f8bf4ee63ea0e9683afde81ee363f9e50ea2eee1bf","title":"Crafted quality tier: Material weights are ignored · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":41.312,"exit_code":1,"observations":[{"actual":{"score":100,"tier":"masterwork"},"check":"heavy rare material #1","expected":{"score":75,"tier":"superior"},"passed":false},{"actual":{"score":100,"tier":"masterwork"},"check":"regression material weighting #1","expected":{"score":86,"tier":"masterwork"},"passed":false},{"actual":{"score":63,"tier":"superior"},"check":"regression material weighting #2","expected":{"score":44,"tier":"superior"},"passed":false},{"actual":{"score":100,"tier":"masterwork"},"check":"regression material weighting #3","expected":{"score":71,"tier":"masterwork"},"passed":false},{"actual":{"score":19,"tier":"common"},"check":"regression material weighting #4","expected":{"score":58,"tier":"fine"},"passed":false},{"actual":{"score":40,"tier":"fine"},"check":"score exactly fine cutoff #1","expected":{"score":40,"tier":"fine"},"passed":true},{"actual":{"score":100,"tier":"masterwork"},"check":"masterwork crit #1","expected":{"score":100,"tier":"masterwork"},"passed":true},{"actual":{"score":40,"tier":"fine"},"check":"control #1","expected":{"score":40,"tier":"fine"},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"heavy rare material #1\", \"actual\": {\"score\": 100, \"tier\": \"masterwork\"}, \"expected\": {\"score\": 75, \"tier\": \"superior\"}, \"passed\": false}, {\"check\": \"regression material weighting #1\", \"actual\": {\"score\": 100, \"tier\": \"masterwork\"}, \"expected\": {\"score\": 86, \"tier\": \"masterwork\"}, \"passed\": false}, {\"check\": \"regression material weighting #2\", \"actual\": {\"score\": 63, \"tier\": \"superior\"}, \"expected\": {\"score\": 44, \"tier\": \"superior\"}, \"passed\": false}, {\"check\": \"regression material weighting #3\", \"actual\": {\"score\": 100, \"tier\": \"masterwork\"}, \"expected\": {\"score\": 71, \"tier\": \"masterwork\"}, \"passed\": false}, {\"check\": \"regression material weighting #4\", \"actual\": {\"score\": 19, \"tier\": \"common\"}, \"expected\": {\"score\": 58, \"tier\": \"fine\"}, \"passed\": false}, {\"check\": \"score exactly fine cutoff #1\", \"actual\": {\"score\": 40, \"tier\": \"fine\"}, \"expected\": {\"score\": 40, \"tier\": \"fine\"}, \"passed\": true}, {\"check\": \"masterwork crit #1\", \"actual\": {\"score\": 100, \"tier\": \"masterwork\"}, \"expected\": {\"score\": 100, \"tier\": \"masterwork\"}, \"passed\": true}, {\"check\": \"control #1\", \"actual\": {\"score\": 40, \"tier\": \"fine\"}, \"expected\": {\"score\": 40, \"tier\": \"fine\"}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.261,"exit_code":1,"observations":[{"actual":{"score":60,"tier":"fine"},"check":"heavy rare material #1","expected":{"score":75,"tier":"superior"},"passed":false},{"actual":{"score":76,"tier":"superior"},"check":"regression material weighting #1","expected":{"score":86,"tier":"masterwork"},"passed":false},{"actual":{"score":67,"tier":"masterwork"},"check":"regression material weighting #2","expected":{"score":44,"tier":"superior"},"passed":false},{"actual":{"score":70,"tier":"masterwork"},"check":"regression material weighting #3","expected":{"score":71,"tier":"masterwork"},"passed":false},{"actual":{"score":52,"tier":"fine"},"check":"regression material weighting #4","expected":{"score":58,"tier":"fine"},"passed":false},{"actual":{"score":40,"tier":"fine"},"check":"score exactly fine cutoff #1","expected":{"score":40,"tier":"fine"},"passed":true},{"actual":{"score":100,"tier":"masterwork"},"check":"masterwork crit #1","expected":{"score":100,"tier":"masterwork"},"passed":true},{"actual":{"score":40,"tier":"fine"},"check":"control #1","expected":{"score":40,"tier":"fine"},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"heavy rare material #1\", \"actual\": {\"score\": 60, \"tier\": \"fine\"}, \"expected\": {\"score\": 75, \"tier\": \"superior\"}, \"passed\": false}, {\"check\": \"regression material weighting #1\", \"actual\": {\"score\": 76, \"tier\": \"superior\"}, \"expected\": {\"score\": 86, \"tier\": \"masterwork\"}, \"passed\": false}, {\"check\": \"regression material weighting #2\", \"actual\": {\"score\": 67, \"tier\": \"masterwork\"}, \"expected\": {\"score\": 44, \"tier\": \"superior\"}, \"passed\": false}, {\"check\": \"regression material weighting #3\", \"actual\": {\"score\": 70, \"tier\": \"masterwork\"}, \"expected\": {\"score\": 71, \"tier\": \"masterwork\"}, \"passed\": false}, {\"check\": \"regression material weighting #4\", \"actual\": {\"score\": 52, \"tier\": \"fine\"}, \"expected\": {\"score\": 58, \"tier\": \"fine\"}, \"passed\": false}, {\"check\": \"score exactly fine cutoff #1\", \"actual\": {\"score\": 40, \"tier\": \"fine\"}, \"expected\": {\"score\": 40, \"tier\": \"fine\"}, \"passed\": true}, {\"check\": \"masterwork crit #1\", \"actual\": {\"score\": 100, \"tier\": \"masterwork\"}, \"expected\": {\"score\": 100, \"tier\": \"masterwork\"}, \"passed\": true}, {\"check\": \"control #1\", \"actual\": {\"score\": 40, \"tier\": \"fine\"}, \"expected\": {\"score\": 40, \"tier\": \"fine\"}, \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}