{"abstract":"The daily cap admits one unit too many.","category":"Game economy crafting balance","checks":8,"contract":"Selling qty units after `sales` units already sold today. Daily cap 20 units total; excess is returned. Per unit, with done = units sold today before it: saturation = min(60, 5*done) percent; unit = floor(base*(100-sat)/100), then floor(unit*(100+bonus)/100) with bonus neutral 0, friendly 5, honored 10; each unit pays at least 1.","contract_signature":"base_price, sales, qty, reputation","evaluation_group":"w2-game-economy-crafting-balance-vendor-saturation","failed_approach":"Checking only this batch lets repeated trips exceed the daily cap.","family":"w2-game-economy-crafting-balance-vendor-saturation-daily-cap-check","id":"FA-85951","implementations":{"attempt":{"sha256":"c803faf2139b0132e1ff46885c133caa0984b92dd1d72a3ed4ad4c7832c5fc24","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(base_price, sales, qty, reputation):\n    bonus = {'neutral': 0, 'friendly': 5, 'honored': 10}[reputation]\n    gold = 0\n    sold = 0\n    for i in range(qty):\n        done = sales + sold\n        if sold >= 20:\n            break\n        sat = min(60, 5 * done)\n        unit = base_price * (100 - sat) // 100\n        unit = unit * (100 + bonus) // 100\n        gold += max(1, unit)\n        sold += 1\n    return {'gold': gold, 'sold': sold, 'returned': qty - sold}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),\n  ('regression daily cap check #1', [2, 15, 10, 'neutral'], {'gold': 5, 'sold': 5, 'returned': 5}),\n  ('regression daily cap check #2', [3, 20, 3, 'honored'], {'gold': 0, 'sold': 0, 'returned': 3}),\n  ('partial repair boundary #1', [2, 22, 2, 'friendly'], {'gold': 0, 'sold': 0, 'returned': 2}),\n  ('partial repair boundary #2', [3, 22, 4, 'honored'], {'gold': 0, 'sold': 0, 'returned': 4}),\n  ('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),\n  ('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),\n  ('control #1', [99, 5, 3, 'neutral'], {'gold': 207, 'sold': 3, 'returned': 0})],\n [('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),\n  ('regression daily cap check #1', [3, 20, 3, 'honored'], {'gold': 0, 'sold': 0, 'returned': 3}),\n  ('regression daily cap check #2', [25, 12, 12, 'neutral'], {'gold': 80, 'sold': 8, 'returned': 4}),\n  ('regression daily cap check #3', [2, 15, 10, 'neutral'], {'gold': 5, 'sold': 5, 'returned': 5}),\n  ('partial repair boundary #1', [3, 22, 4, 'honored'], {'gold': 0, 'sold': 0, 'returned': 4}),\n  ('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),\n  ('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),\n  ('control #1', [99, 5, 3, 'neutral'], {'gold': 207, 'sold': 3, 'returned': 0})],\n [('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),\n  ('regression daily cap check #1', [15, 15, 7, 'friendly'], {'gold': 30, 'sold': 5, 'returned': 2}),\n  ('regression daily cap check #2', [99, 20, 9, 'honored'], {'gold': 0, 'sold': 0, 'returned': 9}),\n  ('partial repair boundary #1', [3, 22, 4, 'honored'], {'gold': 0, 'sold': 0, 'returned': 4}),\n  ('partial repair boundary #2', [10, 22, 10, 'neutral'], {'gold': 0, 'sold': 0, 'returned': 10}),\n  ('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),\n  ('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),\n  ('control #1', [99, 5, 3, 'neutral'], {'gold': 207, 'sold': 3, 'returned': 0})],\n [('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),\n  ('regression daily cap check #1', [99, 19, 4, 'friendly'], {'gold': 40, 'sold': 1, 'returned': 3}),\n  ('regression daily cap check #2', [99, 20, 7, 'neutral'], {'gold': 0, 'sold': 0, 'returned': 7}),\n  ('regression daily cap check #3', [25, 12, 12, 'neutral'], {'gold': 80, 'sold': 8, 'returned': 4}),\n  ('regression daily cap check #4', [15, 15, 7, 'friendly'], {'gold': 30, 'sold': 5, 'returned': 2}),\n  ('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),\n  ('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),\n  ('control #1', [3, 1, 11, 'neutral'], {'gold': 17, 'sold': 11, 'returned': 0})],\n [('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),\n  ('regression daily cap check #1', [1, 15, 12, 'friendly'], {'gold': 5, 'sold': 5, 'returned': 7}),\n  ('regression daily cap check #2', [10, 20, 7, 'honored'], {'gold': 0, 'sold': 0, 'returned': 7}),\n  ('regression daily cap check #3', [99, 20, 9, 'honored'], {'gold': 0, 'sold': 0, 'returned': 9}),\n  ('regression daily cap check #4', [99, 19, 4, 'friendly'], {'gold': 40, 'sold': 1, 'returned': 3}),\n  ('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),\n  ('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),\n  ('control #1', [10, 0, 7, 'friendly'], {'gold': 58, 'sold': 7, 'returned': 0})]]\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":"8e9efd1fc8b4805fb57aa5779e305b6250ee105666db9ccf02f8d29bd202771a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(base_price, sales, qty, reputation):\n    bonus = {'neutral': 0, 'friendly': 5, 'honored': 10}[reputation]\n    gold = 0\n    sold = 0\n    for i in range(qty):\n        done = sales + sold\n        if done > 20:\n            break\n        sat = min(60, 5 * done)\n        unit = base_price * (100 - sat) // 100\n        unit = unit * (100 + bonus) // 100\n        gold += max(1, unit)\n        sold += 1\n    return {'gold': gold, 'sold': sold, 'returned': qty - sold}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),\n  ('regression daily cap check #1', [2, 15, 10, 'neutral'], {'gold': 5, 'sold': 5, 'returned': 5}),\n  ('regression daily cap check #2', [3, 20, 3, 'honored'], {'gold': 0, 'sold': 0, 'returned': 3}),\n  ('partial repair boundary #1', [2, 22, 2, 'friendly'], {'gold': 0, 'sold': 0, 'returned': 2}),\n  ('partial repair boundary #2', [3, 22, 4, 'honored'], {'gold': 0, 'sold': 0, 'returned': 4}),\n  ('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),\n  ('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),\n  ('control #1', [99, 5, 3, 'neutral'], {'gold': 207, 'sold': 3, 'returned': 0})],\n [('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),\n  ('regression daily cap check #1', [3, 20, 3, 'honored'], {'gold': 0, 'sold': 0, 'returned': 3}),\n  ('regression daily cap check #2', [25, 12, 12, 'neutral'], {'gold': 80, 'sold': 8, 'returned': 4}),\n  ('regression daily cap check #3', [2, 15, 10, 'neutral'], {'gold': 5, 'sold': 5, 'returned': 5}),\n  ('partial repair boundary #1', [3, 22, 4, 'honored'], {'gold': 0, 'sold': 0, 'returned': 4}),\n  ('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),\n  ('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),\n  ('control #1', [99, 5, 3, 'neutral'], {'gold': 207, 'sold': 3, 'returned': 0})],\n [('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),\n  ('regression daily cap check #1', [15, 15, 7, 'friendly'], {'gold': 30, 'sold': 5, 'returned': 2}),\n  ('regression daily cap check #2', [99, 20, 9, 'honored'], {'gold': 0, 'sold': 0, 'returned': 9}),\n  ('partial repair boundary #1', [3, 22, 4, 'honored'], {'gold': 0, 'sold': 0, 'returned': 4}),\n  ('partial repair boundary #2', [10, 22, 10, 'neutral'], {'gold': 0, 'sold': 0, 'returned': 10}),\n  ('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),\n  ('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),\n  ('control #1', [99, 5, 3, 'neutral'], {'gold': 207, 'sold': 3, 'returned': 0})],\n [('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),\n  ('regression daily cap check #1', [99, 19, 4, 'friendly'], {'gold': 40, 'sold': 1, 'returned': 3}),\n  ('regression daily cap check #2', [99, 20, 7, 'neutral'], {'gold': 0, 'sold': 0, 'returned': 7}),\n  ('regression daily cap check #3', [25, 12, 12, 'neutral'], {'gold': 80, 'sold': 8, 'returned': 4}),\n  ('regression daily cap check #4', [15, 15, 7, 'friendly'], {'gold': 30, 'sold': 5, 'returned': 2}),\n  ('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),\n  ('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),\n  ('control #1', [3, 1, 11, 'neutral'], {'gold': 17, 'sold': 11, 'returned': 0})],\n [('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),\n  ('regression daily cap check #1', [1, 15, 12, 'friendly'], {'gold': 5, 'sold': 5, 'returned': 7}),\n  ('regression daily cap check #2', [10, 20, 7, 'honored'], {'gold': 0, 'sold': 0, 'returned': 7}),\n  ('regression daily cap check #3', [99, 20, 9, 'honored'], {'gold': 0, 'sold': 0, 'returned': 9}),\n  ('regression daily cap check #4', [99, 19, 4, 'friendly'], {'gold': 40, 'sold': 1, 'returned': 3}),\n  ('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),\n  ('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),\n  ('control #1', [10, 0, 7, 'friendly'], {'gold': 58, 'sold': 7, 'returned': 0})]]\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-vendor-saturation-daily-cap-check","generated_at":"2026-09-29T14:50:45.033556+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":"The cap comparison is strict so the unit at index 20 is still bought.","sha256":"91fe2e250e88f5cead40214bc3373aa99dd2f129bbee18cfb68bf9719977cddd","title":"Vendor sell saturation: Vendor buys a 21st unit · 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":43.537,"exit_code":1,"observations":[{"actual":{"gold":85,"returned":0,"sold":5},"check":"cap reached mid batch #1","expected":{"gold":34,"returned":3,"sold":2},"passed":false},{"actual":{"gold":10,"returned":0,"sold":10},"check":"regression daily cap check #1","expected":{"gold":5,"returned":5,"sold":5},"passed":false},{"actual":{"gold":3,"returned":0,"sold":3},"check":"regression daily cap check #2","expected":{"gold":0,"returned":3,"sold":0},"passed":false},{"actual":{"gold":2,"returned":0,"sold":2},"check":"partial repair boundary #1","expected":{"gold":0,"returned":2,"sold":0},"passed":false},{"actual":{"gold":4,"returned":0,"sold":4},"check":"partial repair boundary #2","expected":{"gold":0,"returned":4,"sold":0},"passed":false},{"actual":{"gold":9,"returned":0,"sold":1},"check":"fresh day single sale #1","expected":{"gold":9,"returned":0,"sold":1},"passed":true},{"actual":{"gold":3,"returned":0,"sold":3},"check":"cheap junk at saturation #1","expected":{"gold":3,"returned":0,"sold":3},"passed":true},{"actual":{"gold":207,"returned":0,"sold":3},"check":"control #1","expected":{"gold":207,"returned":0,"sold":3},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"cap reached mid batch #1\", \"actual\": {\"gold\": 85, \"sold\": 5, \"returned\": 0}, \"expected\": {\"gold\": 34, \"sold\": 2, \"returned\": 3}, \"passed\": false}, {\"check\": \"regression daily cap check #1\", \"actual\": {\"gold\": 10, \"sold\": 10, \"returned\": 0}, \"expected\": {\"gold\": 5, \"sold\": 5, \"returned\": 5}, \"passed\": false}, {\"check\": \"regression daily cap check #2\", \"actual\": {\"gold\": 3, \"sold\": 3, \"returned\": 0}, \"expected\": {\"gold\": 0, \"sold\": 0, \"returned\": 3}, \"passed\": false}, {\"check\": \"partial repair boundary #1\", \"actual\": {\"gold\": 2, \"sold\": 2, \"returned\": 0}, \"expected\": {\"gold\": 0, \"sold\": 0, \"returned\": 2}, \"passed\": false}, {\"check\": \"partial repair boundary #2\", \"actual\": {\"gold\": 4, \"sold\": 4, \"returned\": 0}, \"expected\": {\"gold\": 0, \"sold\": 0, \"returned\": 4}, \"passed\": false}, {\"check\": \"fresh day single sale #1\", \"actual\": {\"gold\": 9, \"sold\": 1, \"returned\": 0}, \"expected\": {\"gold\": 9, \"sold\": 1, \"returned\": 0}, \"passed\": true}, {\"check\": \"cheap junk at saturation #1\", \"actual\": {\"gold\": 3, \"sold\": 3, \"returned\": 0}, \"expected\": {\"gold\": 3, \"sold\": 3, \"returned\": 0}, \"passed\": true}, {\"check\": \"control #1\", \"actual\": {\"gold\": 207, \"sold\": 3, \"returned\": 0}, \"expected\": {\"gold\": 207, \"sold\": 3, \"returned\": 0}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.927,"exit_code":1,"observations":[{"actual":{"gold":51,"returned":2,"sold":3},"check":"cap reached mid batch #1","expected":{"gold":34,"returned":3,"sold":2},"passed":false},{"actual":{"gold":6,"returned":4,"sold":6},"check":"regression daily cap check #1","expected":{"gold":5,"returned":5,"sold":5},"passed":false},{"actual":{"gold":1,"returned":2,"sold":1},"check":"regression daily cap check #2","expected":{"gold":0,"returned":3,"sold":0},"passed":false},{"actual":{"gold":0,"returned":2,"sold":0},"check":"partial repair boundary #1","expected":{"gold":0,"returned":2,"sold":0},"passed":true},{"actual":{"gold":0,"returned":4,"sold":0},"check":"partial repair boundary #2","expected":{"gold":0,"returned":4,"sold":0},"passed":true},{"actual":{"gold":9,"returned":0,"sold":1},"check":"fresh day single sale #1","expected":{"gold":9,"returned":0,"sold":1},"passed":true},{"actual":{"gold":3,"returned":0,"sold":3},"check":"cheap junk at saturation #1","expected":{"gold":3,"returned":0,"sold":3},"passed":true},{"actual":{"gold":207,"returned":0,"sold":3},"check":"control #1","expected":{"gold":207,"returned":0,"sold":3},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"cap reached mid batch #1\", \"actual\": {\"gold\": 51, \"sold\": 3, \"returned\": 2}, \"expected\": {\"gold\": 34, \"sold\": 2, \"returned\": 3}, \"passed\": false}, {\"check\": \"regression daily cap check #1\", \"actual\": {\"gold\": 6, \"sold\": 6, \"returned\": 4}, \"expected\": {\"gold\": 5, \"sold\": 5, \"returned\": 5}, \"passed\": false}, {\"check\": \"regression daily cap check #2\", \"actual\": {\"gold\": 1, \"sold\": 1, \"returned\": 2}, \"expected\": {\"gold\": 0, \"sold\": 0, \"returned\": 3}, \"passed\": false}, {\"check\": \"partial repair boundary #1\", \"actual\": {\"gold\": 0, \"sold\": 0, \"returned\": 2}, \"expected\": {\"gold\": 0, \"sold\": 0, \"returned\": 2}, \"passed\": true}, {\"check\": \"partial repair boundary #2\", \"actual\": {\"gold\": 0, \"sold\": 0, \"returned\": 4}, \"expected\": {\"gold\": 0, \"sold\": 0, \"returned\": 4}, \"passed\": true}, {\"check\": \"fresh day single sale #1\", \"actual\": {\"gold\": 9, \"sold\": 1, \"returned\": 0}, \"expected\": {\"gold\": 9, \"sold\": 1, \"returned\": 0}, \"passed\": true}, {\"check\": \"cheap junk at saturation #1\", \"actual\": {\"gold\": 3, \"sold\": 3, \"returned\": 0}, \"expected\": {\"gold\": 3, \"sold\": 3, \"returned\": 0}, \"passed\": true}, {\"check\": \"control #1\", \"actual\": {\"gold\": 207, \"sold\": 3, \"returned\": 0}, \"expected\": {\"gold\": 207, \"sold\": 3, \"returned\": 0}, \"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."}}