{"abstract":"Magic find boosts rares but not legendaries.","category":"Game economy crafting balance","checks":8,"contract":"table = [[item, rarity, weight], ...]. Non-common weights become floor(w*(100+mf)/100) (mf may be negative). With total boosted weight T (None if 0), target = floor(roll*T/10000) for roll 0..9999; return the first item whose cumulative boosted weight exceeds target.","contract_signature":"table, roll, magic_find","evaluation_group":"w2-game-economy-crafting-balance-loot-magic-find","failed_approach":"Skipping non-positive magic find ignores curse penalties.","family":"w2-game-economy-crafting-balance-loot-magic-find-magic-find-scope","id":"FA-86111","implementations":{"attempt":{"sha256":"997ef8adb5fce8d1705f9d792f565f9a032802b873a42b329d313e2b8cbd5953","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(table, roll, magic_find):\n    weights = []\n    for item, rarity, w in table:\n        if rarity != 'common' and magic_find > 0:\n            w = w * (100 + magic_find) // 100\n        weights.append(w)\n    total = sum(weights)\n    if total == 0:\n        return None\n    target = roll * total // 10000\n    acc = 0\n    for (item, rarity, w0), w in zip(table, weights):\n        acc += w\n        if target < acc:\n            return item\n    return None\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('curse lowers rare #1', [[['gem', 'rare', 10], ['rock', 'common', 10]], 4000, -50], 'rock'),\n  ('fault site magic find scope #1',\n   [[['i0', 'legendary', 10], ['i1', 'rare', 29], ['i2', 'common', 95]], 827, 100],\n   'i0'),\n  ('fault site magic find scope #2',\n   [[['i0', 'rare', 2], ['i1', 'common', 10], ['i2', 'legendary', 10], ['i3', 'rare', 10]], 5000, 250],\n   'i2'),\n  ('partial repair boundary #1', [[['i0', 'rare', 1], ['i1', 'rare', 2]], 1, -50], 'i1'),\n  ('regression magic find scope #1',\n   [[['i0', 'legendary', 10],\n     ['i1', 'common', 0],\n     ['i2', 'common', 2],\n     ['i3', 'rare', 0],\n     ['i4', 'common', 10]],\n    5000,\n    -50],\n   'i4'),\n  ('legendary boosted #1', [[['sword', 'common', 90], ['crown', 'legendary', 10]], 9500, 100], 'crown'),\n  ('zero weight entry skipped #1',\n   [[['a', 'common', 1], ['b', 'rare', 0], ['c', 'common', 1]], 5000, 0],\n   'c'),\n  ('control #1', [[['i0', 'common', 10], ['i1', 'rare', 50]], 9999, 50], 'i1')],\n [('curse lowers rare #1', [[['gem', 'rare', 10], ['rock', 'common', 10]], 4000, -50], 'rock'),\n  ('regression magic find scope #1',\n   [[['i0', 'legendary', 10],\n     ['i1', 'common', 0],\n     ['i2', 'common', 2],\n     ['i3', 'rare', 0],\n     ['i4', 'common', 10]],\n    5000,\n    -50],\n   'i4'),\n  ('fault site magic find scope #1',\n   [[['i0', 'common', 10], ['i1', 'common', 5], ['i2', 'legendary', 2], ['i3', 'legendary', 1]], 4998, 181],\n   'i1'),\n  ('regression magic find scope #2',\n   [[['i0', 'rare', 5], ['i1', 'rare', 5], ['i2', 'common', 1], ['i3', 'rare', 0], ['i4', 'legendary', 1]],\n    9999,\n    -50],\n   'i2'),\n  ('regression magic find scope #3',\n   [[['i0', 'common', 10], ['i1', 'common', 1], ['i2', 'legendary', 50], ['i3', 'legendary', 1]], 9999, -50],\n   'i2'),\n  ('legendary boosted #1', [[['sword', 'common', 90], ['crown', 'legendary', 10]], 9500, 100], 'crown'),\n  ('zero weight entry skipped #1',\n   [[['a', 'common', 1], ['b', 'rare', 0], ['c', 'common', 1]], 5000, 0],\n   'c'),\n  ('control #1', [[['i0', 'common', 10], ['i1', 'rare', 50]], 9999, 50], 'i1')],\n [('curse lowers rare #1', [[['gem', 'rare', 10], ['rock', 'common', 10]], 4000, -50], 'rock'),\n  ('regression magic find scope #1',\n   [[['i0', 'rare', 5], ['i1', 'rare', 5], ['i2', 'common', 1], ['i3', 'rare', 0], ['i4', 'legendary', 1]],\n    9999,\n    -50],\n   'i2'),\n  ('regression magic find scope #2',\n   [[['i0', 'common', 10], ['i1', 'common', 1], ['i2', 'legendary', 50], ['i3', 'legendary', 1]], 9999, -50],\n   'i2'),\n  ('regression magic find scope #3',\n   [[['i0', 'legendary', 10], ['i1', 'rare', 10], ['i2', 'common', 5], ['i3', 'rare', 10], ['i4', 'rare', 1]],\n    5000,\n    -66],\n   'i2'),\n  ('regression magic find scope #4', [[['i0', 'legendary', 1]], 5000, -50], None),\n  ('legendary boosted #1', [[['sword', 'common', 90], ['crown', 'legendary', 10]], 9500, 100], 'crown'),\n  ('zero weight entry skipped #1',\n   [[['a', 'common', 1], ['b', 'rare', 0], ['c', 'common', 1]], 5000, 0],\n   'c'),\n  ('control #1', [[['i0', 'common', 10], ['i1', 'rare', 50]], 9999, 50], 'i1')],\n [('curse lowers rare #1', [[['gem', 'rare', 10], ['rock', 'common', 10]], 4000, -50], 'rock'),\n  ('fault site magic find scope #1',\n   [[['i0', 'legendary', 41], ['i1', 'rare', 1], ['i2', 'rare', 5], ['i3', 'common', 30]], 5000, 110],\n   'i0'),\n  ('fault site magic find scope #2',\n   [[['i0', 'legendary', 55], ['i1', 'common', 50], ['i2', 'legendary', 2], ['i3', 'common', 55]], 5000, 100],\n   'i0'),\n  ('regression magic find scope #1', [[['i0', 'legendary', 1]], 5000, -50], None),\n  ('regression magic find scope #2',\n   [[['i0', 'legendary', 1], ['i1', 'common', 1], ['i2', 'legendary', 50]], 1, -50],\n   'i1'),\n  ('legendary boosted #1', [[['sword', 'common', 90], ['crown', 'legendary', 10]], 9500, 100], 'crown'),\n  ('zero weight entry skipped #1',\n   [[['a', 'common', 1], ['b', 'rare', 0], ['c', 'common', 1]], 5000, 0],\n   'c'),\n  ('control #1', [[['i0', 'common', 10], ['i1', 'common', 50], ['i2', 'legendary', 50]], 793, -50], 'i0')],\n [('curse lowers rare #1', [[['gem', 'rare', 10], ['rock', 'common', 10]], 4000, -50], 'rock'),\n  ('fault site magic find scope #1',\n   [[['i0', 'common', 2], ['i1', 'legendary', 1], ['i2', 'legendary', 2], ['i3', 'legendary', 3]], 3114, 100],\n   'i2'),\n  ('regression magic find scope #1',\n   [[['i0', 'legendary', 10], ['i1', 'rare', 10], ['i2', 'common', 5], ['i3', 'rare', 10], ['i4', 'rare', 1]],\n    5000,\n    -66],\n   'i2'),\n  ('partial repair boundary #1',\n   [[['i0', 'common', 5], ['i1', 'legendary', 2], ['i2', 'rare', 1], ['i3', 'rare', 5], ['i4', 'common', 0]],\n    5000,\n    -50],\n   'i0'),\n  ('regression magic find scope #2',\n   [[['i0', 'legendary', 1], ['i1', 'rare', 2], ['i2', 'legendary', 5], ['i3', 'rare', 5]], 0, -16],\n   'i1'),\n  ('legendary boosted #1', [[['sword', 'common', 90], ['crown', 'legendary', 10]], 9500, 100], 'crown'),\n  ('zero weight entry skipped #1',\n   [[['a', 'common', 1], ['b', 'rare', 0], ['c', 'common', 1]], 5000, 0],\n   'c'),\n  ('control #1', [[['i0', 'rare', 1], ['i1', 'common', 10], ['i2', 'legendary', 93]], 0, 100], 'i0')]]\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":"c43bd94e40e5539d092a49981cd9b155f6300c5ed356f9f61d2bb4d58320bb3d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(table, roll, magic_find):\n    weights = []\n    for item, rarity, w in table:\n        if rarity == 'rare':\n            w = w * (100 + magic_find) // 100\n        weights.append(w)\n    total = sum(weights)\n    if total == 0:\n        return None\n    target = roll * total // 10000\n    acc = 0\n    for (item, rarity, w0), w in zip(table, weights):\n        acc += w\n        if target < acc:\n            return item\n    return None\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('curse lowers rare #1', [[['gem', 'rare', 10], ['rock', 'common', 10]], 4000, -50], 'rock'),\n  ('fault site magic find scope #1',\n   [[['i0', 'legendary', 10], ['i1', 'rare', 29], ['i2', 'common', 95]], 827, 100],\n   'i0'),\n  ('fault site magic find scope #2',\n   [[['i0', 'rare', 2], ['i1', 'common', 10], ['i2', 'legendary', 10], ['i3', 'rare', 10]], 5000, 250],\n   'i2'),\n  ('partial repair boundary #1', [[['i0', 'rare', 1], ['i1', 'rare', 2]], 1, -50], 'i1'),\n  ('regression magic find scope #1',\n   [[['i0', 'legendary', 10],\n     ['i1', 'common', 0],\n     ['i2', 'common', 2],\n     ['i3', 'rare', 0],\n     ['i4', 'common', 10]],\n    5000,\n    -50],\n   'i4'),\n  ('legendary boosted #1', [[['sword', 'common', 90], ['crown', 'legendary', 10]], 9500, 100], 'crown'),\n  ('zero weight entry skipped #1',\n   [[['a', 'common', 1], ['b', 'rare', 0], ['c', 'common', 1]], 5000, 0],\n   'c'),\n  ('control #1', [[['i0', 'common', 10], ['i1', 'rare', 50]], 9999, 50], 'i1')],\n [('curse lowers rare #1', [[['gem', 'rare', 10], ['rock', 'common', 10]], 4000, -50], 'rock'),\n  ('regression magic find scope #1',\n   [[['i0', 'legendary', 10],\n     ['i1', 'common', 0],\n     ['i2', 'common', 2],\n     ['i3', 'rare', 0],\n     ['i4', 'common', 10]],\n    5000,\n    -50],\n   'i4'),\n  ('fault site magic find scope #1',\n   [[['i0', 'common', 10], ['i1', 'common', 5], ['i2', 'legendary', 2], ['i3', 'legendary', 1]], 4998, 181],\n   'i1'),\n  ('regression magic find scope #2',\n   [[['i0', 'rare', 5], ['i1', 'rare', 5], ['i2', 'common', 1], ['i3', 'rare', 0], ['i4', 'legendary', 1]],\n    9999,\n    -50],\n   'i2'),\n  ('regression magic find scope #3',\n   [[['i0', 'common', 10], ['i1', 'common', 1], ['i2', 'legendary', 50], ['i3', 'legendary', 1]], 9999, -50],\n   'i2'),\n  ('legendary boosted #1', [[['sword', 'common', 90], ['crown', 'legendary', 10]], 9500, 100], 'crown'),\n  ('zero weight entry skipped #1',\n   [[['a', 'common', 1], ['b', 'rare', 0], ['c', 'common', 1]], 5000, 0],\n   'c'),\n  ('control #1', [[['i0', 'common', 10], ['i1', 'rare', 50]], 9999, 50], 'i1')],\n [('curse lowers rare #1', [[['gem', 'rare', 10], ['rock', 'common', 10]], 4000, -50], 'rock'),\n  ('regression magic find scope #1',\n   [[['i0', 'rare', 5], ['i1', 'rare', 5], ['i2', 'common', 1], ['i3', 'rare', 0], ['i4', 'legendary', 1]],\n    9999,\n    -50],\n   'i2'),\n  ('regression magic find scope #2',\n   [[['i0', 'common', 10], ['i1', 'common', 1], ['i2', 'legendary', 50], ['i3', 'legendary', 1]], 9999, -50],\n   'i2'),\n  ('regression magic find scope #3',\n   [[['i0', 'legendary', 10], ['i1', 'rare', 10], ['i2', 'common', 5], ['i3', 'rare', 10], ['i4', 'rare', 1]],\n    5000,\n    -66],\n   'i2'),\n  ('regression magic find scope #4', [[['i0', 'legendary', 1]], 5000, -50], None),\n  ('legendary boosted #1', [[['sword', 'common', 90], ['crown', 'legendary', 10]], 9500, 100], 'crown'),\n  ('zero weight entry skipped #1',\n   [[['a', 'common', 1], ['b', 'rare', 0], ['c', 'common', 1]], 5000, 0],\n   'c'),\n  ('control #1', [[['i0', 'common', 10], ['i1', 'rare', 50]], 9999, 50], 'i1')],\n [('curse lowers rare #1', [[['gem', 'rare', 10], ['rock', 'common', 10]], 4000, -50], 'rock'),\n  ('fault site magic find scope #1',\n   [[['i0', 'legendary', 41], ['i1', 'rare', 1], ['i2', 'rare', 5], ['i3', 'common', 30]], 5000, 110],\n   'i0'),\n  ('fault site magic find scope #2',\n   [[['i0', 'legendary', 55], ['i1', 'common', 50], ['i2', 'legendary', 2], ['i3', 'common', 55]], 5000, 100],\n   'i0'),\n  ('regression magic find scope #1', [[['i0', 'legendary', 1]], 5000, -50], None),\n  ('regression magic find scope #2',\n   [[['i0', 'legendary', 1], ['i1', 'common', 1], ['i2', 'legendary', 50]], 1, -50],\n   'i1'),\n  ('legendary boosted #1', [[['sword', 'common', 90], ['crown', 'legendary', 10]], 9500, 100], 'crown'),\n  ('zero weight entry skipped #1',\n   [[['a', 'common', 1], ['b', 'rare', 0], ['c', 'common', 1]], 5000, 0],\n   'c'),\n  ('control #1', [[['i0', 'common', 10], ['i1', 'common', 50], ['i2', 'legendary', 50]], 793, -50], 'i0')],\n [('curse lowers rare #1', [[['gem', 'rare', 10], ['rock', 'common', 10]], 4000, -50], 'rock'),\n  ('fault site magic find scope #1',\n   [[['i0', 'common', 2], ['i1', 'legendary', 1], ['i2', 'legendary', 2], ['i3', 'legendary', 3]], 3114, 100],\n   'i2'),\n  ('regression magic find scope #1',\n   [[['i0', 'legendary', 10], ['i1', 'rare', 10], ['i2', 'common', 5], ['i3', 'rare', 10], ['i4', 'rare', 1]],\n    5000,\n    -66],\n   'i2'),\n  ('partial repair boundary #1',\n   [[['i0', 'common', 5], ['i1', 'legendary', 2], ['i2', 'rare', 1], ['i3', 'rare', 5], ['i4', 'common', 0]],\n    5000,\n    -50],\n   'i0'),\n  ('regression magic find scope #2',\n   [[['i0', 'legendary', 1], ['i1', 'rare', 2], ['i2', 'legendary', 5], ['i3', 'rare', 5]], 0, -16],\n   'i1'),\n  ('legendary boosted #1', [[['sword', 'common', 90], ['crown', 'legendary', 10]], 9500, 100], 'crown'),\n  ('zero weight entry skipped #1',\n   [[['a', 'common', 1], ['b', 'rare', 0], ['c', 'common', 1]], 5000, 0],\n   'c'),\n  ('control #1', [[['i0', 'rare', 1], ['i1', 'common', 10], ['i2', 'legendary', 93]], 0, 100], 'i0')]]\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-loot-magic-find-magic-find-scope","generated_at":"2026-09-29T14:50:46.628644+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 boost applies only to the rare tier instead of every non-common tier.","sha256":"17adc094abdd2da42f8ae5365ad8d3e4a01fe56f04bc102d1cd55413d8903b83","title":"Magic find loot roll: Magic find skips legendary items · 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":40.419,"exit_code":1,"observations":[{"actual":"gem","check":"curse lowers rare #1","expected":"rock","passed":false},{"actual":"i0","check":"fault site magic find scope #1","expected":"i0","passed":true},{"actual":"i2","check":"fault site magic find scope #2","expected":"i2","passed":true},{"actual":"i0","check":"partial repair boundary #1","expected":"i1","passed":false},{"actual":"i2","check":"regression magic find scope #1","expected":"i4","passed":false},{"actual":"crown","check":"legendary boosted #1","expected":"crown","passed":true},{"actual":"c","check":"zero weight entry skipped #1","expected":"c","passed":true},{"actual":"i1","check":"control #1","expected":"i1","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"curse lowers rare #1\", \"actual\": \"gem\", \"expected\": \"rock\", \"passed\": false}, {\"check\": \"fault site magic find scope #1\", \"actual\": \"i0\", \"expected\": \"i0\", \"passed\": true}, {\"check\": \"fault site magic find scope #2\", \"actual\": \"i2\", \"expected\": \"i2\", \"passed\": true}, {\"check\": \"partial repair boundary #1\", \"actual\": \"i0\", \"expected\": \"i1\", \"passed\": false}, {\"check\": \"regression magic find scope #1\", \"actual\": \"i2\", \"expected\": \"i4\", \"passed\": false}, {\"check\": \"legendary boosted #1\", \"actual\": \"crown\", \"expected\": \"crown\", \"passed\": true}, {\"check\": \"zero weight entry skipped #1\", \"actual\": \"c\", \"expected\": \"c\", \"passed\": true}, {\"check\": \"control #1\", \"actual\": \"i1\", \"expected\": \"i1\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.746,"exit_code":1,"observations":[{"actual":"rock","check":"curse lowers rare #1","expected":"rock","passed":true},{"actual":"i1","check":"fault site magic find scope #1","expected":"i0","passed":false},{"actual":"i3","check":"fault site magic find scope #2","expected":"i2","passed":false},{"actual":"i1","check":"partial repair boundary #1","expected":"i1","passed":true},{"actual":"i2","check":"regression magic find scope #1","expected":"i4","passed":false},{"actual":"crown","check":"legendary boosted #1","expected":"crown","passed":true},{"actual":"c","check":"zero weight entry skipped #1","expected":"c","passed":true},{"actual":"i1","check":"control #1","expected":"i1","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"curse lowers rare #1\", \"actual\": \"rock\", \"expected\": \"rock\", \"passed\": true}, {\"check\": \"fault site magic find scope #1\", \"actual\": \"i1\", \"expected\": \"i0\", \"passed\": false}, {\"check\": \"fault site magic find scope #2\", \"actual\": \"i3\", \"expected\": \"i2\", \"passed\": false}, {\"check\": \"partial repair boundary #1\", \"actual\": \"i1\", \"expected\": \"i1\", \"passed\": true}, {\"check\": \"regression magic find scope #1\", \"actual\": \"i2\", \"expected\": \"i4\", \"passed\": false}, {\"check\": \"legendary boosted #1\", \"actual\": \"crown\", \"expected\": \"crown\", \"passed\": true}, {\"check\": \"zero weight entry skipped #1\", \"actual\": \"c\", \"expected\": \"c\", \"passed\": true}, {\"check\": \"control #1\", \"actual\": \"i1\", \"expected\": \"i1\", \"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."}}