{"abstract":"An enemy costing exactly the remaining budget is skipped.","category":"Procedural level generation constraints","checks":8,"contract":"budget = 10 + 5*depth + 10*(depth//5). roster [name, cost, min_depth] with cost >= 1. Repeatedly pick the most expensive unlocked (min_depth <= depth) affordable enemy with fewer than 3 copies already picked, ties broken by name; stop when none qualifies. Returns {picks, left}.","evaluation_group":"w2-procedural-level-generation-constraints-difficulty-budget","failed_approach":"Allowing a one-point overspend drives the budget negative.","family":"w2-procedural-level-generation-constraints-difficulty-budget-affordability","id":"FA-86561","implementations":{"attempt":{"sha256":"846345397a31ae632d0f50aa6c3e12083728f8a04bc7e09cd11f109015239a3c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(depth, roster):\n    budget = 10 + 5 * depth + depth // 5 * 10\n    counts = {}\n    picks = []\n    while True:\n        best = None\n        for name, cost, need in roster:\n            if need > depth or cost - 1 > budget or counts.get(name, 0) >= 3:\n                continue\n            if best is None or cost > best[1] or (cost == best[1] and name < best[0]):\n                best = (name, cost)\n        if best is None:\n            break\n        picks.append(best[0])\n        counts[best[0]] = counts.get(best[0], 0) + 1\n        budget -= best[1]\n    return {'picks': picks, 'left': budget}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('regression affordability #1',\n   [10, [['imp', 2, 10], ['ogre', 5, 10], ['rat', 1, 3], ['bat', 2, 0], ['orc', 5, 3], ['wyrm', 24, 10]]],\n   {'picks': ['wyrm', 'wyrm', 'wyrm', 'ogre', 'bat', 'rat'], 'left': 0}),\n  ('fault site affordability #1',\n   [4, [['rat', 5, 5], ['ogre', 5, 0], ['wyrm', 5, 1], ['imp', 5, 3]]],\n   {'picks': ['imp', 'imp', 'imp', 'ogre', 'ogre', 'ogre'], 'left': 0}),\n  ('partial repair boundary #1',\n   [1, [['orc', 5, 3], ['bat', 8, 1], ['wyrm', 8, 0]]],\n   {'picks': ['bat'], 'left': 7}),\n  ('regression affordability #2',\n   [5, [['bat', 8, 1], ['orc', 15, 10], ['wyrm', 10, 1], ['ogre', 1, 3], ['rat', 1, 3], ['imp', 2, 0]]],\n   {'picks': ['wyrm', 'wyrm', 'wyrm', 'bat', 'imp', 'imp', 'imp', 'ogre'], 'left': 0}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1',\n   [1, [['imp', 10, 1], ['bat', 10, 10], ['orc', 1, 0]]],\n   {'picks': ['imp', 'orc', 'orc', 'orc'], 'left': 2})],\n [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('fault site affordability #1',\n   [4, [['rat', 5, 5], ['ogre', 5, 0], ['wyrm', 5, 1], ['imp', 5, 3]]],\n   {'picks': ['imp', 'imp', 'imp', 'ogre', 'ogre', 'ogre'], 'left': 0}),\n  ('regression affordability #1',\n   [5, [['bat', 8, 1], ['orc', 15, 10], ['wyrm', 10, 1], ['ogre', 1, 3], ['rat', 1, 3], ['imp', 2, 0]]],\n   {'picks': ['wyrm', 'wyrm', 'wyrm', 'bat', 'imp', 'imp', 'imp', 'ogre'], 'left': 0}),\n  ('regression affordability #2',\n   [1, [['bat', 8, 3], ['rat', 5, 10], ['imp', 2, 1], ['orc', 1, 0], ['ogre', 15, 0], ['wyrm', 1, 1]]],\n   {'picks': ['ogre'], 'left': 0}),\n  ('partial repair boundary #1',\n   [1, [['rat', 2, 3], ['imp', 8, 0], ['orc', 10, 10], ['ogre', 5, 3], ['bat', 5, 5], ['wyrm', 26, 0]]],\n   {'picks': ['imp'], 'left': 7}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1',\n   [1, [['imp', 10, 1], ['bat', 10, 10], ['orc', 1, 0]]],\n   {'picks': ['imp', 'orc', 'orc', 'orc'], 'left': 2})],\n [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('fault site affordability #1',\n   [10, [['imp', 15, 10], ['ogre', 5, 1], ['orc', 5, 5], ['rat', 5, 0], ['wyrm', 10, 1]]],\n   {'picks': ['imp', 'imp', 'imp', 'wyrm', 'wyrm', 'wyrm', 'ogre'], 'left': 0}),\n  ('fault site affordability #2',\n   [1, [['wyrm', 8, 10], ['ogre', 5, 1]]],\n   {'picks': ['ogre', 'ogre', 'ogre'], 'left': 0}),\n  ('partial repair boundary #1',\n   [1, [['rat', 2, 3], ['imp', 8, 0], ['orc', 10, 10], ['ogre', 5, 3], ['bat', 5, 5], ['wyrm', 26, 0]]],\n   {'picks': ['imp'], 'left': 7}),\n  ('regression affordability #1',\n   [4, [['bat', 15, 3], ['wyrm', 5, 0], ['orc', 2, 3], ['rat', 5, 0], ['imp', 19, 10], ['ogre', 1, 1]]],\n   {'picks': ['bat', 'bat'], 'left': 0}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1',\n   [1, [['imp', 10, 1], ['bat', 10, 10], ['orc', 1, 0]]],\n   {'picks': ['imp', 'orc', 'orc', 'orc'], 'left': 2})],\n [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('fault site affordability #1',\n   [1, [['wyrm', 8, 3], ['rat', 5, 1]]],\n   {'picks': ['rat', 'rat', 'rat'], 'left': 0}),\n  ('fault site affordability #2',\n   [14, [['orc', 30, 1], ['bat', 15, 5], ['ogre', 5, 0], ['rat', 5, 5]]],\n   {'picks': ['orc', 'orc', 'orc', 'ogre', 'ogre'], 'left': 0}),\n  ('partial repair boundary #1', [1, [['orc', 20, 3], ['wyrm', 8, 0]]], {'picks': ['wyrm'], 'left': 7}),\n  ('partial repair boundary #2',\n   [1, [['bat', 2, 3], ['imp', 8, 1], ['ogre', 8, 10]]],\n   {'picks': ['imp'], 'left': 7}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1', [15, [['ogre', 5, 1]]], {'picks': ['ogre', 'ogre', 'ogre'], 'left': 100})],\n [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('fault site affordability #1',\n   [9, [['imp', 25, 3], ['bat', 5, 5]]],\n   {'picks': ['imp', 'imp', 'bat', 'bat', 'bat'], 'left': 0}),\n  ('fault site affordability #2',\n   [4, [['wyrm', 20, 5], ['orc', 5, 10], ['rat', 10, 10], ['bat', 15, 0]]],\n   {'picks': ['bat', 'bat'], 'left': 0}),\n  ('regression affordability #1',\n   [4, [['bat', 1, 0], ['wyrm', 15, 5], ['rat', 20, 1], ['imp', 2, 3], ['orc', 2, 1], ['ogre', 15, 3]]],\n   {'picks': ['rat', 'imp', 'imp', 'imp', 'orc', 'orc'], 'left': 0}),\n  ('regression affordability #2',\n   [0, [['imp', 5, 0], ['orc', 15, 10], ['ogre', 10, 10], ['wyrm', 1, 0], ['rat', 16, 1], ['bat', 5, 0]]],\n   {'picks': ['bat', 'bat'], 'left': 0}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1', [5, [['orc', 10, 1], ['imp', 5, 10]]], {'picks': ['orc', 'orc', 'orc'], 'left': 15})]]\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":"9ee339edb57e74f8ddc36475334beff6c53cb3d769489f36e3b41bc3e2f91055","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(depth, roster):\n    budget = 10 + 5 * depth + depth // 5 * 10\n    counts = {}\n    picks = []\n    while True:\n        best = None\n        for name, cost, need in roster:\n            if need > depth or cost >= budget or counts.get(name, 0) >= 3:\n                continue\n            if best is None or cost > best[1] or (cost == best[1] and name < best[0]):\n                best = (name, cost)\n        if best is None:\n            break\n        picks.append(best[0])\n        counts[best[0]] = counts.get(best[0], 0) + 1\n        budget -= best[1]\n    return {'picks': picks, 'left': budget}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('regression affordability #1',\n   [10, [['imp', 2, 10], ['ogre', 5, 10], ['rat', 1, 3], ['bat', 2, 0], ['orc', 5, 3], ['wyrm', 24, 10]]],\n   {'picks': ['wyrm', 'wyrm', 'wyrm', 'ogre', 'bat', 'rat'], 'left': 0}),\n  ('fault site affordability #1',\n   [4, [['rat', 5, 5], ['ogre', 5, 0], ['wyrm', 5, 1], ['imp', 5, 3]]],\n   {'picks': ['imp', 'imp', 'imp', 'ogre', 'ogre', 'ogre'], 'left': 0}),\n  ('partial repair boundary #1',\n   [1, [['orc', 5, 3], ['bat', 8, 1], ['wyrm', 8, 0]]],\n   {'picks': ['bat'], 'left': 7}),\n  ('regression affordability #2',\n   [5, [['bat', 8, 1], ['orc', 15, 10], ['wyrm', 10, 1], ['ogre', 1, 3], ['rat', 1, 3], ['imp', 2, 0]]],\n   {'picks': ['wyrm', 'wyrm', 'wyrm', 'bat', 'imp', 'imp', 'imp', 'ogre'], 'left': 0}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1',\n   [1, [['imp', 10, 1], ['bat', 10, 10], ['orc', 1, 0]]],\n   {'picks': ['imp', 'orc', 'orc', 'orc'], 'left': 2})],\n [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('fault site affordability #1',\n   [4, [['rat', 5, 5], ['ogre', 5, 0], ['wyrm', 5, 1], ['imp', 5, 3]]],\n   {'picks': ['imp', 'imp', 'imp', 'ogre', 'ogre', 'ogre'], 'left': 0}),\n  ('regression affordability #1',\n   [5, [['bat', 8, 1], ['orc', 15, 10], ['wyrm', 10, 1], ['ogre', 1, 3], ['rat', 1, 3], ['imp', 2, 0]]],\n   {'picks': ['wyrm', 'wyrm', 'wyrm', 'bat', 'imp', 'imp', 'imp', 'ogre'], 'left': 0}),\n  ('regression affordability #2',\n   [1, [['bat', 8, 3], ['rat', 5, 10], ['imp', 2, 1], ['orc', 1, 0], ['ogre', 15, 0], ['wyrm', 1, 1]]],\n   {'picks': ['ogre'], 'left': 0}),\n  ('partial repair boundary #1',\n   [1, [['rat', 2, 3], ['imp', 8, 0], ['orc', 10, 10], ['ogre', 5, 3], ['bat', 5, 5], ['wyrm', 26, 0]]],\n   {'picks': ['imp'], 'left': 7}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1',\n   [1, [['imp', 10, 1], ['bat', 10, 10], ['orc', 1, 0]]],\n   {'picks': ['imp', 'orc', 'orc', 'orc'], 'left': 2})],\n [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('fault site affordability #1',\n   [10, [['imp', 15, 10], ['ogre', 5, 1], ['orc', 5, 5], ['rat', 5, 0], ['wyrm', 10, 1]]],\n   {'picks': ['imp', 'imp', 'imp', 'wyrm', 'wyrm', 'wyrm', 'ogre'], 'left': 0}),\n  ('fault site affordability #2',\n   [1, [['wyrm', 8, 10], ['ogre', 5, 1]]],\n   {'picks': ['ogre', 'ogre', 'ogre'], 'left': 0}),\n  ('partial repair boundary #1',\n   [1, [['rat', 2, 3], ['imp', 8, 0], ['orc', 10, 10], ['ogre', 5, 3], ['bat', 5, 5], ['wyrm', 26, 0]]],\n   {'picks': ['imp'], 'left': 7}),\n  ('regression affordability #1',\n   [4, [['bat', 15, 3], ['wyrm', 5, 0], ['orc', 2, 3], ['rat', 5, 0], ['imp', 19, 10], ['ogre', 1, 1]]],\n   {'picks': ['bat', 'bat'], 'left': 0}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1',\n   [1, [['imp', 10, 1], ['bat', 10, 10], ['orc', 1, 0]]],\n   {'picks': ['imp', 'orc', 'orc', 'orc'], 'left': 2})],\n [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('fault site affordability #1',\n   [1, [['wyrm', 8, 3], ['rat', 5, 1]]],\n   {'picks': ['rat', 'rat', 'rat'], 'left': 0}),\n  ('fault site affordability #2',\n   [14, [['orc', 30, 1], ['bat', 15, 5], ['ogre', 5, 0], ['rat', 5, 5]]],\n   {'picks': ['orc', 'orc', 'orc', 'ogre', 'ogre'], 'left': 0}),\n  ('partial repair boundary #1', [1, [['orc', 20, 3], ['wyrm', 8, 0]]], {'picks': ['wyrm'], 'left': 7}),\n  ('partial repair boundary #2',\n   [1, [['bat', 2, 3], ['imp', 8, 1], ['ogre', 8, 10]]],\n   {'picks': ['imp'], 'left': 7}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1', [15, [['ogre', 5, 1]]], {'picks': ['ogre', 'ogre', 'ogre'], 'left': 100})],\n [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('fault site affordability #1',\n   [9, [['imp', 25, 3], ['bat', 5, 5]]],\n   {'picks': ['imp', 'imp', 'bat', 'bat', 'bat'], 'left': 0}),\n  ('fault site affordability #2',\n   [4, [['wyrm', 20, 5], ['orc', 5, 10], ['rat', 10, 10], ['bat', 15, 0]]],\n   {'picks': ['bat', 'bat'], 'left': 0}),\n  ('regression affordability #1',\n   [4, [['bat', 1, 0], ['wyrm', 15, 5], ['rat', 20, 1], ['imp', 2, 3], ['orc', 2, 1], ['ogre', 15, 3]]],\n   {'picks': ['rat', 'imp', 'imp', 'imp', 'orc', 'orc'], 'left': 0}),\n  ('regression affordability #2',\n   [0, [['imp', 5, 0], ['orc', 15, 10], ['ogre', 10, 10], ['wyrm', 1, 0], ['rat', 16, 1], ['bat', 5, 0]]],\n   {'picks': ['bat', 'bat'], 'left': 0}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1', [5, [['orc', 10, 1], ['imp', 5, 10]]], {'picks': ['orc', 'orc', 'orc'], 'left': 15})]]\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"},"fixed":{"sha256":"076631c7f4188c5b0a0edc7da352e09bf2b34d7ee5492a4a856468de3bbe8f6e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(depth, roster):\n    budget = 10 + 5 * depth + depth // 5 * 10\n    counts = {}\n    picks = []\n    while True:\n        best = None\n        for name, cost, need in roster:\n            if need > depth or cost > budget or counts.get(name, 0) >= 3:\n                continue\n            if best is None or cost > best[1] or (cost == best[1] and name < best[0]):\n                best = (name, cost)\n        if best is None:\n            break\n        picks.append(best[0])\n        counts[best[0]] = counts.get(best[0], 0) + 1\n        budget -= best[1]\n    return {'picks': picks, 'left': budget}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('regression affordability #1',\n   [10, [['imp', 2, 10], ['ogre', 5, 10], ['rat', 1, 3], ['bat', 2, 0], ['orc', 5, 3], ['wyrm', 24, 10]]],\n   {'picks': ['wyrm', 'wyrm', 'wyrm', 'ogre', 'bat', 'rat'], 'left': 0}),\n  ('fault site affordability #1',\n   [4, [['rat', 5, 5], ['ogre', 5, 0], ['wyrm', 5, 1], ['imp', 5, 3]]],\n   {'picks': ['imp', 'imp', 'imp', 'ogre', 'ogre', 'ogre'], 'left': 0}),\n  ('partial repair boundary #1',\n   [1, [['orc', 5, 3], ['bat', 8, 1], ['wyrm', 8, 0]]],\n   {'picks': ['bat'], 'left': 7}),\n  ('regression affordability #2',\n   [5, [['bat', 8, 1], ['orc', 15, 10], ['wyrm', 10, 1], ['ogre', 1, 3], ['rat', 1, 3], ['imp', 2, 0]]],\n   {'picks': ['wyrm', 'wyrm', 'wyrm', 'bat', 'imp', 'imp', 'imp', 'ogre'], 'left': 0}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1',\n   [1, [['imp', 10, 1], ['bat', 10, 10], ['orc', 1, 0]]],\n   {'picks': ['imp', 'orc', 'orc', 'orc'], 'left': 2})],\n [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('fault site affordability #1',\n   [4, [['rat', 5, 5], ['ogre', 5, 0], ['wyrm', 5, 1], ['imp', 5, 3]]],\n   {'picks': ['imp', 'imp', 'imp', 'ogre', 'ogre', 'ogre'], 'left': 0}),\n  ('regression affordability #1',\n   [5, [['bat', 8, 1], ['orc', 15, 10], ['wyrm', 10, 1], ['ogre', 1, 3], ['rat', 1, 3], ['imp', 2, 0]]],\n   {'picks': ['wyrm', 'wyrm', 'wyrm', 'bat', 'imp', 'imp', 'imp', 'ogre'], 'left': 0}),\n  ('regression affordability #2',\n   [1, [['bat', 8, 3], ['rat', 5, 10], ['imp', 2, 1], ['orc', 1, 0], ['ogre', 15, 0], ['wyrm', 1, 1]]],\n   {'picks': ['ogre'], 'left': 0}),\n  ('partial repair boundary #1',\n   [1, [['rat', 2, 3], ['imp', 8, 0], ['orc', 10, 10], ['ogre', 5, 3], ['bat', 5, 5], ['wyrm', 26, 0]]],\n   {'picks': ['imp'], 'left': 7}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1',\n   [1, [['imp', 10, 1], ['bat', 10, 10], ['orc', 1, 0]]],\n   {'picks': ['imp', 'orc', 'orc', 'orc'], 'left': 2})],\n [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('fault site affordability #1',\n   [10, [['imp', 15, 10], ['ogre', 5, 1], ['orc', 5, 5], ['rat', 5, 0], ['wyrm', 10, 1]]],\n   {'picks': ['imp', 'imp', 'imp', 'wyrm', 'wyrm', 'wyrm', 'ogre'], 'left': 0}),\n  ('fault site affordability #2',\n   [1, [['wyrm', 8, 10], ['ogre', 5, 1]]],\n   {'picks': ['ogre', 'ogre', 'ogre'], 'left': 0}),\n  ('partial repair boundary #1',\n   [1, [['rat', 2, 3], ['imp', 8, 0], ['orc', 10, 10], ['ogre', 5, 3], ['bat', 5, 5], ['wyrm', 26, 0]]],\n   {'picks': ['imp'], 'left': 7}),\n  ('regression affordability #1',\n   [4, [['bat', 15, 3], ['wyrm', 5, 0], ['orc', 2, 3], ['rat', 5, 0], ['imp', 19, 10], ['ogre', 1, 1]]],\n   {'picks': ['bat', 'bat'], 'left': 0}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1',\n   [1, [['imp', 10, 1], ['bat', 10, 10], ['orc', 1, 0]]],\n   {'picks': ['imp', 'orc', 'orc', 'orc'], 'left': 2})],\n [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('fault site affordability #1',\n   [1, [['wyrm', 8, 3], ['rat', 5, 1]]],\n   {'picks': ['rat', 'rat', 'rat'], 'left': 0}),\n  ('fault site affordability #2',\n   [14, [['orc', 30, 1], ['bat', 15, 5], ['ogre', 5, 0], ['rat', 5, 5]]],\n   {'picks': ['orc', 'orc', 'orc', 'ogre', 'ogre'], 'left': 0}),\n  ('partial repair boundary #1', [1, [['orc', 20, 3], ['wyrm', 8, 0]]], {'picks': ['wyrm'], 'left': 7}),\n  ('partial repair boundary #2',\n   [1, [['bat', 2, 3], ['imp', 8, 1], ['ogre', 8, 10]]],\n   {'picks': ['imp'], 'left': 7}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1', [15, [['ogre', 5, 1]]], {'picks': ['ogre', 'ogre', 'ogre'], 'left': 100})],\n [('equal cost tie #1', [0, [['orc', 5, 0], ['imp', 5, 0]]], {'picks': ['imp', 'imp'], 'left': 0}),\n  ('fault site affordability #1',\n   [9, [['imp', 25, 3], ['bat', 5, 5]]],\n   {'picks': ['imp', 'imp', 'bat', 'bat', 'bat'], 'left': 0}),\n  ('fault site affordability #2',\n   [4, [['wyrm', 20, 5], ['orc', 5, 10], ['rat', 10, 10], ['bat', 15, 0]]],\n   {'picks': ['bat', 'bat'], 'left': 0}),\n  ('regression affordability #1',\n   [4, [['bat', 1, 0], ['wyrm', 15, 5], ['rat', 20, 1], ['imp', 2, 3], ['orc', 2, 1], ['ogre', 15, 3]]],\n   {'picks': ['rat', 'imp', 'imp', 'imp', 'orc', 'orc'], 'left': 0}),\n  ('regression affordability #2',\n   [0, [['imp', 5, 0], ['orc', 15, 10], ['ogre', 10, 10], ['wyrm', 1, 0], ['rat', 16, 1], ['bat', 5, 0]]],\n   {'picks': ['bat', 'bat'], 'left': 0}),\n  ('milestone depth bonus #1', [5, [['orc', 5, 0]]], {'picks': ['orc', 'orc', 'orc'], 'left': 30}),\n  ('unlock at depth #1',\n   [3, [['ogre', 10, 3], ['rat', 1, 0]]],\n   {'picks': ['ogre', 'ogre', 'rat', 'rat', 'rat'], 'left': 2}),\n  ('control #1', [5, [['orc', 10, 1], ['imp', 5, 10]]], {'picks': ['orc', 'orc', 'orc'], 'left': 15})]]\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-procedural-level-generation-constraints-difficulty-budget-affordability","generated_at":"2026-09-29T14:50:50.768845+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Procedural generators silently emit unplayable or unfair levels when a single constraint check uses the wrong boundary, axis, neighborhood or update order; the defect is visible in exact generated geometry.","repair":"Restore `cost > budget` at the affordability step.","root_cause":"Affordability requires strictly more budget than cost.","sha256":"0344f4a1af0126e6cf7ba054df32949ef4a211a9dbcd7ab8f2986bd258c2c1ed","title":"Encounter difficulty budget: Budget cannot be spent to zero · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.154,"exit_code":1,"observations":[{"actual":{"left":0,"picks":["imp","imp"]},"check":"equal cost tie #1","expected":{"left":0,"picks":["imp","imp"]},"passed":true},{"actual":{"left":-1,"picks":["wyrm","wyrm","wyrm","ogre","bat","bat"]},"check":"regression affordability #1","expected":{"left":0,"picks":["wyrm","wyrm","wyrm","ogre","bat","rat"]},"passed":false},{"actual":{"left":0,"picks":["imp","imp","imp","ogre","ogre","ogre"]},"check":"fault site affordability #1","expected":{"left":0,"picks":["imp","imp","imp","ogre","ogre","ogre"]},"passed":true},{"actual":{"left":-1,"picks":["bat","bat"]},"check":"partial repair boundary #1","expected":{"left":7,"picks":["bat"]},"passed":false},{"actual":{"left":-1,"picks":["wyrm","wyrm","wyrm","bat","bat"]},"check":"regression affordability #2","expected":{"left":0,"picks":["wyrm","wyrm","wyrm","bat","imp","imp","imp","ogre"]},"passed":false},{"actual":{"left":30,"picks":["orc","orc","orc"]},"check":"milestone depth bonus #1","expected":{"left":30,"picks":["orc","orc","orc"]},"passed":true},{"actual":{"left":2,"picks":["ogre","ogre","rat","rat","rat"]},"check":"unlock at depth #1","expected":{"left":2,"picks":["ogre","ogre","rat","rat","rat"]},"passed":true},{"actual":{"left":2,"picks":["imp","orc","orc","orc"]},"check":"control #1","expected":{"left":2,"picks":["imp","orc","orc","orc"]},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"equal cost tie #1\", \"actual\": {\"picks\": [\"imp\", \"imp\"], \"left\": 0}, \"expected\": {\"picks\": [\"imp\", \"imp\"], \"left\": 0}, \"passed\": true}, {\"check\": \"regression affordability #1\", \"actual\": {\"picks\": [\"wyrm\", \"wyrm\", \"wyrm\", \"ogre\", \"bat\", \"bat\"], \"left\": -1}, \"expected\": {\"picks\": [\"wyrm\", \"wyrm\", \"wyrm\", \"ogre\", \"bat\", \"rat\"], \"left\": 0}, \"passed\": false}, {\"check\": \"fault site affordability #1\", \"actual\": {\"picks\": [\"imp\", \"imp\", \"imp\", \"ogre\", \"ogre\", \"ogre\"], \"left\": 0}, \"expected\": {\"picks\": [\"imp\", \"imp\", \"imp\", \"ogre\", \"ogre\", \"ogre\"], \"left\": 0}, \"passed\": true}, {\"check\": \"partial repair boundary #1\", \"actual\": {\"picks\": [\"bat\", \"bat\"], \"left\": -1}, \"expected\": {\"picks\": [\"bat\"], \"left\": 7}, \"passed\": false}, {\"check\": \"regression affordability #2\", \"actual\": {\"picks\": [\"wyrm\", \"wyrm\", \"wyrm\", \"bat\", \"bat\"], \"left\": -1}, \"expected\": {\"picks\": [\"wyrm\", \"wyrm\", \"wyrm\", \"bat\", \"imp\", \"imp\", \"imp\", \"ogre\"], \"left\": 0}, \"passed\": false}, {\"check\": \"milestone depth bonus #1\", \"actual\": {\"picks\": [\"orc\", \"orc\", \"orc\"], \"left\": 30}, \"expected\": {\"picks\": [\"orc\", \"orc\", \"orc\"], \"left\": 30}, \"passed\": true}, {\"check\": \"unlock at depth #1\", \"actual\": {\"picks\": [\"ogre\", \"ogre\", \"rat\", \"rat\", \"rat\"], \"left\": 2}, \"expected\": {\"picks\": [\"ogre\", \"ogre\", \"rat\", \"rat\", \"rat\"], \"left\": 2}, \"passed\": true}, {\"check\": \"control #1\", \"actual\": {\"picks\": [\"imp\", \"orc\", \"orc\", \"orc\"], \"left\": 2}, \"expected\": {\"picks\": [\"imp\", \"orc\", \"orc\", \"orc\"], \"left\": 2}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.343,"exit_code":1,"observations":[{"actual":{"left":5,"picks":["imp"]},"check":"equal cost tie #1","expected":{"left":0,"picks":["imp","imp"]},"passed":false},{"actual":{"left":1,"picks":["wyrm","wyrm","wyrm","ogre","bat"]},"check":"regression affordability #1","expected":{"left":0,"picks":["wyrm","wyrm","wyrm","ogre","bat","rat"]},"passed":false},{"actual":{"left":5,"picks":["imp","imp","imp","ogre","ogre"]},"check":"fault site affordability #1","expected":{"left":0,"picks":["imp","imp","imp","ogre","ogre","ogre"]},"passed":false},{"actual":{"left":7,"picks":["bat"]},"check":"partial repair boundary #1","expected":{"left":7,"picks":["bat"]},"passed":true},{"actual":{"left":1,"picks":["wyrm","wyrm","wyrm","bat","imp","imp","imp"]},"check":"regression affordability #2","expected":{"left":0,"picks":["wyrm","wyrm","wyrm","bat","imp","imp","imp","ogre"]},"passed":false},{"actual":{"left":30,"picks":["orc","orc","orc"]},"check":"milestone depth bonus #1","expected":{"left":30,"picks":["orc","orc","orc"]},"passed":true},{"actual":{"left":2,"picks":["ogre","ogre","rat","rat","rat"]},"check":"unlock at depth #1","expected":{"left":2,"picks":["ogre","ogre","rat","rat","rat"]},"passed":true},{"actual":{"left":2,"picks":["imp","orc","orc","orc"]},"check":"control #1","expected":{"left":2,"picks":["imp","orc","orc","orc"]},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"equal cost tie #1\", \"actual\": {\"picks\": [\"imp\"], \"left\": 5}, \"expected\": {\"picks\": [\"imp\", \"imp\"], \"left\": 0}, \"passed\": false}, {\"check\": \"regression affordability #1\", \"actual\": {\"picks\": [\"wyrm\", \"wyrm\", \"wyrm\", \"ogre\", \"bat\"], \"left\": 1}, \"expected\": {\"picks\": [\"wyrm\", \"wyrm\", \"wyrm\", \"ogre\", \"bat\", \"rat\"], \"left\": 0}, \"passed\": false}, {\"check\": \"fault site affordability #1\", \"actual\": {\"picks\": [\"imp\", \"imp\", \"imp\", \"ogre\", \"ogre\"], \"left\": 5}, \"expected\": {\"picks\": [\"imp\", \"imp\", \"imp\", \"ogre\", \"ogre\", \"ogre\"], \"left\": 0}, \"passed\": false}, {\"check\": \"partial repair boundary #1\", \"actual\": {\"picks\": [\"bat\"], \"left\": 7}, \"expected\": {\"picks\": [\"bat\"], \"left\": 7}, \"passed\": true}, {\"check\": \"regression affordability #2\", \"actual\": {\"picks\": [\"wyrm\", \"wyrm\", \"wyrm\", \"bat\", \"imp\", \"imp\", \"imp\"], \"left\": 1}, \"expected\": {\"picks\": [\"wyrm\", \"wyrm\", \"wyrm\", \"bat\", \"imp\", \"imp\", \"imp\", \"ogre\"], \"left\": 0}, \"passed\": false}, {\"check\": \"milestone depth bonus #1\", \"actual\": {\"picks\": [\"orc\", \"orc\", \"orc\"], \"left\": 30}, \"expected\": {\"picks\": [\"orc\", \"orc\", \"orc\"], \"left\": 30}, \"passed\": true}, {\"check\": \"unlock at depth #1\", \"actual\": {\"picks\": [\"ogre\", \"ogre\", \"rat\", \"rat\", \"rat\"], \"left\": 2}, \"expected\": {\"picks\": [\"ogre\", \"ogre\", \"rat\", \"rat\", \"rat\"], \"left\": 2}, \"passed\": true}, {\"check\": \"control #1\", \"actual\": {\"picks\": [\"imp\", \"orc\", \"orc\", \"orc\"], \"left\": 2}, \"expected\": {\"picks\": [\"imp\", \"orc\", \"orc\", \"orc\"], \"left\": 2}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.141,"exit_code":0,"observations":[{"actual":{"left":0,"picks":["imp","imp"]},"check":"equal cost tie #1","expected":{"left":0,"picks":["imp","imp"]},"passed":true},{"actual":{"left":0,"picks":["wyrm","wyrm","wyrm","ogre","bat","rat"]},"check":"regression affordability #1","expected":{"left":0,"picks":["wyrm","wyrm","wyrm","ogre","bat","rat"]},"passed":true},{"actual":{"left":0,"picks":["imp","imp","imp","ogre","ogre","ogre"]},"check":"fault site affordability #1","expected":{"left":0,"picks":["imp","imp","imp","ogre","ogre","ogre"]},"passed":true},{"actual":{"left":7,"picks":["bat"]},"check":"partial repair boundary #1","expected":{"left":7,"picks":["bat"]},"passed":true},{"actual":{"left":0,"picks":["wyrm","wyrm","wyrm","bat","imp","imp","imp","ogre"]},"check":"regression affordability #2","expected":{"left":0,"picks":["wyrm","wyrm","wyrm","bat","imp","imp","imp","ogre"]},"passed":true},{"actual":{"left":30,"picks":["orc","orc","orc"]},"check":"milestone depth bonus #1","expected":{"left":30,"picks":["orc","orc","orc"]},"passed":true},{"actual":{"left":2,"picks":["ogre","ogre","rat","rat","rat"]},"check":"unlock at depth #1","expected":{"left":2,"picks":["ogre","ogre","rat","rat","rat"]},"passed":true},{"actual":{"left":2,"picks":["imp","orc","orc","orc"]},"check":"control #1","expected":{"left":2,"picks":["imp","orc","orc","orc"]},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"equal cost tie #1\", \"actual\": {\"picks\": [\"imp\", \"imp\"], \"left\": 0}, \"expected\": {\"picks\": [\"imp\", \"imp\"], \"left\": 0}, \"passed\": true}, {\"check\": \"regression affordability #1\", \"actual\": {\"picks\": [\"wyrm\", \"wyrm\", \"wyrm\", \"ogre\", \"bat\", \"rat\"], \"left\": 0}, \"expected\": {\"picks\": [\"wyrm\", \"wyrm\", \"wyrm\", \"ogre\", \"bat\", \"rat\"], \"left\": 0}, \"passed\": true}, {\"check\": \"fault site affordability #1\", \"actual\": {\"picks\": [\"imp\", \"imp\", \"imp\", \"ogre\", \"ogre\", \"ogre\"], \"left\": 0}, \"expected\": {\"picks\": [\"imp\", \"imp\", \"imp\", \"ogre\", \"ogre\", \"ogre\"], \"left\": 0}, \"passed\": true}, {\"check\": \"partial repair boundary #1\", \"actual\": {\"picks\": [\"bat\"], \"left\": 7}, \"expected\": {\"picks\": [\"bat\"], \"left\": 7}, \"passed\": true}, {\"check\": \"regression affordability #2\", \"actual\": {\"picks\": [\"wyrm\", \"wyrm\", \"wyrm\", \"bat\", \"imp\", \"imp\", \"imp\", \"ogre\"], \"left\": 0}, \"expected\": {\"picks\": [\"wyrm\", \"wyrm\", \"wyrm\", \"bat\", \"imp\", \"imp\", \"imp\", \"ogre\"], \"left\": 0}, \"passed\": true}, {\"check\": \"milestone depth bonus #1\", \"actual\": {\"picks\": [\"orc\", \"orc\", \"orc\"], \"left\": 30}, \"expected\": {\"picks\": [\"orc\", \"orc\", \"orc\"], \"left\": 30}, \"passed\": true}, {\"check\": \"unlock at depth #1\", \"actual\": {\"picks\": [\"ogre\", \"ogre\", \"rat\", \"rat\", \"rat\"], \"left\": 2}, \"expected\": {\"picks\": [\"ogre\", \"ogre\", \"rat\", \"rat\", \"rat\"], \"left\": 2}, \"passed\": true}, {\"check\": \"control #1\", \"actual\": {\"picks\": [\"imp\", \"orc\", \"orc\", \"orc\"], \"left\": 2}, \"expected\": {\"picks\": [\"imp\", \"orc\", \"orc\", \"orc\"], \"left\": 2}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}