{"abstract":"Rested pool is consumed after the level cap.","category":"Game economy crafting balance","checks":8,"contract":"Level L needs 80 + 20*L xp to reach L+1; max level 50. Gains are ignored once level 50 is reached (rested untouched). For each gain g: bonus = min(g, rested) is added on top of g and removed from the rested pool; then as many levels as possible are taken, carrying remaining xp; on reaching level 50 the xp bar is set to 0. Returns [level, xp, rested].","contract_signature":"level, xp, gains, rested","evaluation_group":"w2-game-economy-crafting-balance-rested-xp","failed_approach":"Only skipping when rested is empty still drains rested at cap.","family":"w2-game-economy-crafting-balance-rested-xp-cap-gain-skip","id":"FA-86336","implementations":{"attempt":{"sha256":"2e84c3603386a311860c40ed0eb0c86a000c7d2cd8932bbe20100e4924b3c5bf","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(level, xp, gains, rested):\n    for g in gains:\n        if level >= 50 and rested == 0:\n            break\n        bonus = min(g, rested)\n        rested -= bonus\n        xp += g + bonus\n        while level < 50 and xp >= 80 + 20 * level:\n            xp -= 80 + 20 * level\n            level += 1\n        if level >= 50:\n            xp = 0\n    return [level, xp, rested]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('gain at cap keeps rested #1', [50, 0, [100], 40], [50, 0, 40]),\n  ('regression cap gain skip #1', [50, 56, [99], 100], [50, 56, 100]),\n  ('regression cap gain skip #2', [50, 12, [2000, 50, 300, 50], 30], [50, 12, 30]),\n  ('regression cap gain skip #3', [50, 44, [10], 100], [50, 44, 100]),\n  ('regression cap gain skip #4', [50, 62, [300, 2000, 300], 100], [50, 62, 100]),\n  ('multi-level gain #1', [1, 0, [300], 0], [3, 80, 0]),\n  ('exact threshold #1', [10, 0, [280], 0], [11, 0, 0]),\n  ('control #1', [48, 123, [50, 10, 420], 100], [48, 703, 0])],\n [('gain at cap keeps rested #1', [50, 0, [100], 40], [50, 0, 40]),\n  ('regression cap gain skip #1', [50, 12, [2000, 50, 300, 50], 30], [50, 12, 30]),\n  ('regression cap gain skip #2', [50, 44, [10], 100], [50, 44, 100]),\n  ('regression cap gain skip #3', [50, 62, [300, 2000, 300], 100], [50, 62, 100]),\n  ('regression cap gain skip #4', [49, 101, [300, 300, 100, 99, 100], 1000], [50, 0, 400]),\n  ('multi-level gain #1', [1, 0, [300], 0], [3, 80, 0]),\n  ('exact threshold #1', [10, 0, [280], 0], [11, 0, 0]),\n  ('control #1', [48, 123, [50, 10, 420], 100], [48, 703, 0])],\n [('gain at cap keeps rested #1', [50, 0, [100], 40], [50, 0, 40]),\n  ('fault site cap gain skip #1', [50, 110, [50, 10], 0], [50, 110, 0]),\n  ('regression cap gain skip #1', [50, 62, [300, 2000, 300], 100], [50, 62, 100]),\n  ('regression cap gain skip #2', [49, 101, [300, 300, 100, 99, 100], 1000], [50, 0, 400]),\n  ('regression cap gain skip #3', [50, 124, [100, 300, 2000, 415], 1000], [50, 124, 1000]),\n  ('multi-level gain #1', [1, 0, [300], 0], [3, 80, 0]),\n  ('exact threshold #1', [10, 0, [280], 0], [11, 0, 0]),\n  ('control #1', [48, 123, [50, 10, 420], 100], [48, 703, 0])],\n [('gain at cap keeps rested #1', [50, 0, [100], 40], [50, 0, 40]),\n  ('regression cap gain skip #1', [49, 101, [300, 300, 100, 99, 100], 1000], [50, 0, 400]),\n  ('regression cap gain skip #2', [50, 124, [100, 300, 2000, 415], 1000], [50, 124, 1000]),\n  ('regression cap gain skip #3', [50, 145, [10], 80], [50, 145, 80]),\n  ('regression cap gain skip #4', [50, 65, [2000, 100, 10], 1000], [50, 65, 1000]),\n  ('multi-level gain #1', [1, 0, [300], 0], [3, 80, 0]),\n  ('exact threshold #1', [10, 0, [280], 0], [11, 0, 0]),\n  ('control #1', [5, 79, [300], 0], [6, 199, 0])],\n [('gain at cap keeps rested #1', [50, 0, [100], 40], [50, 0, 40]),\n  ('fault site cap gain skip #1', [50, 85, [10, 207, 99], 0], [50, 85, 0]),\n  ('fault site cap gain skip #2', [50, 29, [10, 249, 50, 100], 0], [50, 29, 0]),\n  ('regression cap gain skip #1', [50, 65, [2000, 100, 10], 1000], [50, 65, 1000]),\n  ('regression cap gain skip #2', [50, 95, [100, 61], 157], [50, 95, 157]),\n  ('multi-level gain #1', [1, 0, [300], 0], [3, 80, 0]),\n  ('exact threshold #1', [10, 0, [280], 0], [11, 0, 0]),\n  ('control #1', [10, 7, [300, 50, 99, 100], 0], [11, 276, 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":"524788ca6bc22372a17ec8f98508ed42c69fd84f4d6af06fc6e9a6d8e08c626b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(level, xp, gains, rested):\n    for g in gains:\n        if level > 50:\n            break\n        bonus = min(g, rested)\n        rested -= bonus\n        xp += g + bonus\n        while level < 50 and xp >= 80 + 20 * level:\n            xp -= 80 + 20 * level\n            level += 1\n        if level >= 50:\n            xp = 0\n    return [level, xp, rested]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('gain at cap keeps rested #1', [50, 0, [100], 40], [50, 0, 40]),\n  ('regression cap gain skip #1', [50, 56, [99], 100], [50, 56, 100]),\n  ('regression cap gain skip #2', [50, 12, [2000, 50, 300, 50], 30], [50, 12, 30]),\n  ('regression cap gain skip #3', [50, 44, [10], 100], [50, 44, 100]),\n  ('regression cap gain skip #4', [50, 62, [300, 2000, 300], 100], [50, 62, 100]),\n  ('multi-level gain #1', [1, 0, [300], 0], [3, 80, 0]),\n  ('exact threshold #1', [10, 0, [280], 0], [11, 0, 0]),\n  ('control #1', [48, 123, [50, 10, 420], 100], [48, 703, 0])],\n [('gain at cap keeps rested #1', [50, 0, [100], 40], [50, 0, 40]),\n  ('regression cap gain skip #1', [50, 12, [2000, 50, 300, 50], 30], [50, 12, 30]),\n  ('regression cap gain skip #2', [50, 44, [10], 100], [50, 44, 100]),\n  ('regression cap gain skip #3', [50, 62, [300, 2000, 300], 100], [50, 62, 100]),\n  ('regression cap gain skip #4', [49, 101, [300, 300, 100, 99, 100], 1000], [50, 0, 400]),\n  ('multi-level gain #1', [1, 0, [300], 0], [3, 80, 0]),\n  ('exact threshold #1', [10, 0, [280], 0], [11, 0, 0]),\n  ('control #1', [48, 123, [50, 10, 420], 100], [48, 703, 0])],\n [('gain at cap keeps rested #1', [50, 0, [100], 40], [50, 0, 40]),\n  ('fault site cap gain skip #1', [50, 110, [50, 10], 0], [50, 110, 0]),\n  ('regression cap gain skip #1', [50, 62, [300, 2000, 300], 100], [50, 62, 100]),\n  ('regression cap gain skip #2', [49, 101, [300, 300, 100, 99, 100], 1000], [50, 0, 400]),\n  ('regression cap gain skip #3', [50, 124, [100, 300, 2000, 415], 1000], [50, 124, 1000]),\n  ('multi-level gain #1', [1, 0, [300], 0], [3, 80, 0]),\n  ('exact threshold #1', [10, 0, [280], 0], [11, 0, 0]),\n  ('control #1', [48, 123, [50, 10, 420], 100], [48, 703, 0])],\n [('gain at cap keeps rested #1', [50, 0, [100], 40], [50, 0, 40]),\n  ('regression cap gain skip #1', [49, 101, [300, 300, 100, 99, 100], 1000], [50, 0, 400]),\n  ('regression cap gain skip #2', [50, 124, [100, 300, 2000, 415], 1000], [50, 124, 1000]),\n  ('regression cap gain skip #3', [50, 145, [10], 80], [50, 145, 80]),\n  ('regression cap gain skip #4', [50, 65, [2000, 100, 10], 1000], [50, 65, 1000]),\n  ('multi-level gain #1', [1, 0, [300], 0], [3, 80, 0]),\n  ('exact threshold #1', [10, 0, [280], 0], [11, 0, 0]),\n  ('control #1', [5, 79, [300], 0], [6, 199, 0])],\n [('gain at cap keeps rested #1', [50, 0, [100], 40], [50, 0, 40]),\n  ('fault site cap gain skip #1', [50, 85, [10, 207, 99], 0], [50, 85, 0]),\n  ('fault site cap gain skip #2', [50, 29, [10, 249, 50, 100], 0], [50, 29, 0]),\n  ('regression cap gain skip #1', [50, 65, [2000, 100, 10], 1000], [50, 65, 1000]),\n  ('regression cap gain skip #2', [50, 95, [100, 61], 157], [50, 95, 157]),\n  ('multi-level gain #1', [1, 0, [300], 0], [3, 80, 0]),\n  ('exact threshold #1', [10, 0, [280], 0], [11, 0, 0]),\n  ('control #1', [10, 7, [300, 50, 99, 100], 0], [11, 276, 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-rested-xp-cap-gain-skip","generated_at":"2026-09-29T14:50:48.645440+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 test for ignoring gains is strict.","sha256":"1e8c21c9a3076a1e5fa6b161807bae200bfce0568ce1499a4aea7e315f7420f3","title":"Crafting XP with rested pool: Capped characters burn rested xp · 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":42.09,"exit_code":1,"observations":[{"actual":[50,0,0],"check":"gain at cap keeps rested #1","expected":[50,0,40],"passed":false},{"actual":[50,0,1],"check":"regression cap gain skip #1","expected":[50,56,100],"passed":false},{"actual":[50,0,0],"check":"regression cap gain skip #2","expected":[50,12,30],"passed":false},{"actual":[50,0,90],"check":"regression cap gain skip #3","expected":[50,44,100],"passed":false},{"actual":[50,0,0],"check":"regression cap gain skip #4","expected":[50,62,100],"passed":false},{"actual":[3,80,0],"check":"multi-level gain #1","expected":[3,80,0],"passed":true},{"actual":[11,0,0],"check":"exact threshold #1","expected":[11,0,0],"passed":true},{"actual":[48,703,0],"check":"control #1","expected":[48,703,0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"gain at cap keeps rested #1\", \"actual\": [50, 0, 0], \"expected\": [50, 0, 40], \"passed\": false}, {\"check\": \"regression cap gain skip #1\", \"actual\": [50, 0, 1], \"expected\": [50, 56, 100], \"passed\": false}, {\"check\": \"regression cap gain skip #2\", \"actual\": [50, 0, 0], \"expected\": [50, 12, 30], \"passed\": false}, {\"check\": \"regression cap gain skip #3\", \"actual\": [50, 0, 90], \"expected\": [50, 44, 100], \"passed\": false}, {\"check\": \"regression cap gain skip #4\", \"actual\": [50, 0, 0], \"expected\": [50, 62, 100], \"passed\": false}, {\"check\": \"multi-level gain #1\", \"actual\": [3, 80, 0], \"expected\": [3, 80, 0], \"passed\": true}, {\"check\": \"exact threshold #1\", \"actual\": [11, 0, 0], \"expected\": [11, 0, 0], \"passed\": true}, {\"check\": \"control #1\", \"actual\": [48, 703, 0], \"expected\": [48, 703, 0], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.529,"exit_code":1,"observations":[{"actual":[50,0,0],"check":"gain at cap keeps rested #1","expected":[50,0,40],"passed":false},{"actual":[50,0,1],"check":"regression cap gain skip #1","expected":[50,56,100],"passed":false},{"actual":[50,0,0],"check":"regression cap gain skip #2","expected":[50,12,30],"passed":false},{"actual":[50,0,90],"check":"regression cap gain skip #3","expected":[50,44,100],"passed":false},{"actual":[50,0,0],"check":"regression cap gain skip #4","expected":[50,62,100],"passed":false},{"actual":[3,80,0],"check":"multi-level gain #1","expected":[3,80,0],"passed":true},{"actual":[11,0,0],"check":"exact threshold #1","expected":[11,0,0],"passed":true},{"actual":[48,703,0],"check":"control #1","expected":[48,703,0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"gain at cap keeps rested #1\", \"actual\": [50, 0, 0], \"expected\": [50, 0, 40], \"passed\": false}, {\"check\": \"regression cap gain skip #1\", \"actual\": [50, 0, 1], \"expected\": [50, 56, 100], \"passed\": false}, {\"check\": \"regression cap gain skip #2\", \"actual\": [50, 0, 0], \"expected\": [50, 12, 30], \"passed\": false}, {\"check\": \"regression cap gain skip #3\", \"actual\": [50, 0, 90], \"expected\": [50, 44, 100], \"passed\": false}, {\"check\": \"regression cap gain skip #4\", \"actual\": [50, 0, 0], \"expected\": [50, 62, 100], \"passed\": false}, {\"check\": \"multi-level gain #1\", \"actual\": [3, 80, 0], \"expected\": [3, 80, 0], \"passed\": true}, {\"check\": \"exact threshold #1\", \"actual\": [11, 0, 0], \"expected\": [11, 0, 0], \"passed\": true}, {\"check\": \"control #1\", \"actual\": [48, 703, 0], \"expected\": [48, 703, 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."}}