{"abstract":"Placed each-way bets return a fraction of the stake instead of stake plus place winnings.","category":"Betting odds conversion","checks":8,"contract":"Each-way settlement with dead heats. stake_cents is the stake of each part (win and place). odds is fractional \"a/b\"; terms \"1/4\" or \"1/5\" is the place fraction of the odds. position is the finishing position shared by dead_heat runners (1 = no dead heat), occupying positions position .. position + dead_heat - 1. Win part: paid if position == 1 with stake / dead_heat at 1 + a/b. Place part: paid if position <= places_paid, with stake scaled by min(dead_heat, places_paid - position + 1) / dead_heat at 1 + (a/b) * terms. Return the total return in cents rounded down.","evaluation_group":"w2-odds-conversion-each-way-dead-heat","failed_approach":"Applying the terms to the fractional odds but not returning the stake still underpays.","family":"w2-odds-conversion-each-way-dead-heat-place-odds-fraction","id":"FA-84486","implementations":{"attempt":{"sha256":"3a287bd9e5709802003e84d360b2d71b65939af4b2869ff48230e3e8bb199478","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nimport math\nN = 1\nobservations = []\ndef solve(stake_cents, odds, terms, position, places_paid, dead_heat):\n    a, b = map(int, odds.split('/'))\n    f = Fraction(a, b)\n    tn, td = map(int, terms.split('/'))\n    place_f = f * Fraction(tn, td)\n    ret = Fraction(0)\n    if position == 1:\n        ret += Fraction(stake_cents, dead_heat) * (1 + f)\n    if position <= places_paid:\n        share = Fraction(min(dead_heat, places_paid - position + 1), dead_heat)\n        ret += stake_cents * share * place_f\n    return math.floor(ret)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ndef run(args):\n    try:\n        return solve(*args)\n    except Exception as exc:\n        return 'raised ' + type(exc).__name__\ncases = [[('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (100, '14/5', '1/5', 4, 4, 1), 156),\n  ('variant scenario 1', (100, '8/4', '1/4', 6, 5, 2), 0),\n  ('variant scenario 2', (100, '6/2', '1/5', 1, 2, 2), 360)],\n [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (1000, '7/4', '1/4', 2, 4, 1), 1437),\n  ('variant scenario 1', (500, '26/5', '1/5', 3, 5, 3), 1020),\n  ('variant scenario 2', (500, '18/1', '1/5', 2, 3, 1), 2300)],\n [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (500, '15/1', '1/5', 2, 4, 2), 2000),\n  ('variant scenario 1', (500, '10/1', '1/5', 3, 2, 1), 0),\n  ('variant scenario 2', (250, '10/2', '1/4', 5, 5, 1), 562)],\n [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (100, '27/1', '1/4', 5, 5, 1), 775),\n  ('variant scenario 1', (250, '3/4', '1/4', 3, 2, 1), 0),\n  ('variant scenario 2', (1000, '18/5', '1/4', 4, 5, 2), 1900)],\n [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (500, '17/1', '1/5', 4, 4, 1), 2200),\n  ('variant scenario 1', (1000, '22/1', '1/4', 5, 4, 1), 0),\n  ('variant scenario 2', (100, '20/5', '1/5', 1, 4, 2), 430)]]\nfor label, args, expected in cases[N - 1]:\n    check(label, run(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":"fb3e2ce600f85bc7c11c7a7d3bd57a57bb772832e678ef017ca2a74e04d8cf6d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nimport math\nN = 1\nobservations = []\ndef solve(stake_cents, odds, terms, position, places_paid, dead_heat):\n    a, b = map(int, odds.split('/'))\n    f = Fraction(a, b)\n    tn, td = map(int, terms.split('/'))\n    place_f = f * Fraction(tn, td)\n    ret = Fraction(0)\n    if position == 1:\n        ret += Fraction(stake_cents, dead_heat) * (1 + f)\n    if position <= places_paid:\n        share = Fraction(min(dead_heat, places_paid - position + 1), dead_heat)\n        ret += stake_cents * share * (1 + f) * Fraction(tn, td)\n    return math.floor(ret)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ndef run(args):\n    try:\n        return solve(*args)\n    except Exception as exc:\n        return 'raised ' + type(exc).__name__\ncases = [[('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (100, '14/5', '1/5', 4, 4, 1), 156),\n  ('variant scenario 1', (100, '8/4', '1/4', 6, 5, 2), 0),\n  ('variant scenario 2', (100, '6/2', '1/5', 1, 2, 2), 360)],\n [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (1000, '7/4', '1/4', 2, 4, 1), 1437),\n  ('variant scenario 1', (500, '26/5', '1/5', 3, 5, 3), 1020),\n  ('variant scenario 2', (500, '18/1', '1/5', 2, 3, 1), 2300)],\n [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (500, '15/1', '1/5', 2, 4, 2), 2000),\n  ('variant scenario 1', (500, '10/1', '1/5', 3, 2, 1), 0),\n  ('variant scenario 2', (250, '10/2', '1/4', 5, 5, 1), 562)],\n [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (100, '27/1', '1/4', 5, 5, 1), 775),\n  ('variant scenario 1', (250, '3/4', '1/4', 3, 2, 1), 0),\n  ('variant scenario 2', (1000, '18/5', '1/4', 4, 5, 2), 1900)],\n [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (500, '17/1', '1/5', 4, 4, 1), 2200),\n  ('variant scenario 1', (1000, '22/1', '1/4', 5, 4, 1), 0),\n  ('variant scenario 2', (100, '20/5', '1/5', 1, 4, 2), 430)]]\nfor label, args, expected in cases[N - 1]:\n    check(label, run(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":"6c2fb088048cce24987c1ffb4412c812520836eac41c16cb93dbb1409435bb10","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nimport math\nN = 1\nobservations = []\ndef solve(stake_cents, odds, terms, position, places_paid, dead_heat):\n    a, b = map(int, odds.split('/'))\n    f = Fraction(a, b)\n    tn, td = map(int, terms.split('/'))\n    place_f = f * Fraction(tn, td)\n    ret = Fraction(0)\n    if position == 1:\n        ret += Fraction(stake_cents, dead_heat) * (1 + f)\n    if position <= places_paid:\n        share = Fraction(min(dead_heat, places_paid - position + 1), dead_heat)\n        ret += stake_cents * share * (1 + place_f)\n    return math.floor(ret)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ndef run(args):\n    try:\n        return solve(*args)\n    except Exception as exc:\n        return 'raised ' + type(exc).__name__\ncases = [[('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (100, '14/5', '1/5', 4, 4, 1), 156),\n  ('variant scenario 1', (100, '8/4', '1/4', 6, 5, 2), 0),\n  ('variant scenario 2', (100, '6/2', '1/5', 1, 2, 2), 360)],\n [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (1000, '7/4', '1/4', 2, 4, 1), 1437),\n  ('variant scenario 1', (500, '26/5', '1/5', 3, 5, 3), 1020),\n  ('variant scenario 2', (500, '18/1', '1/5', 2, 3, 1), 2300)],\n [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (500, '15/1', '1/5', 2, 4, 2), 2000),\n  ('variant scenario 1', (500, '10/1', '1/5', 3, 2, 1), 0),\n  ('variant scenario 2', (250, '10/2', '1/4', 5, 5, 1), 562)],\n [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (100, '27/1', '1/4', 5, 5, 1), 775),\n  ('variant scenario 1', (250, '3/4', '1/4', 3, 2, 1), 0),\n  ('variant scenario 2', (1000, '18/5', '1/4', 4, 5, 2), 1900)],\n [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),\n  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),\n  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),\n  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),\n  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),\n  ('regression: place odds fraction', (500, '17/1', '1/5', 4, 4, 1), 2200),\n  ('variant scenario 1', (1000, '22/1', '1/4', 5, 4, 1), 0),\n  ('variant scenario 2', (100, '20/5', '1/5', 1, 4, 2), 430)]]\nfor label, args, expected in cases[N - 1]:\n    check(label, run(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":"Stipulated, bounded toy contract stated in the contract field; not a claim of conformance with any operator, exchange or regulator rule set. 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-odds-conversion-each-way-dead-heat-place-odds-fraction","generated_at":"2026-09-29T14:50:31.221005+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Horse-racing settlement applies place terms and dead-heat reductions to each part separately.","repair":"Apply the terms to the fractional odds and add back the stake.","root_cause":"The place part multiplies the whole decimal price by the terms.","sha256":"fd5d8077338af50976b1a38d0d40bd359380e13d8f2016b7061022eda3f703d1","title":"Place terms applied to the decimal price · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":43.241,"exit_code":1,"observations":[{"actual":6000,"check":"control winner","expected":7000,"passed":false},{"actual":1000,"check":"control placed","expected":2000,"passed":false},{"actual":0,"check":"control unplaced","expected":0,"passed":true},{"actual":3300,"check":"boundary dead heat for the win","expected":4300,"passed":false},{"actual":1000,"check":"boundary dead heat for last place","expected":1500,"passed":false},{"actual":56,"check":"regression: place odds fraction","expected":156,"passed":false},{"actual":0,"check":"variant scenario 1","expected":0,"passed":true},{"actual":260,"check":"variant scenario 2","expected":360,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"control winner\", \"actual\": 6000, \"expected\": 7000, \"passed\": false}, {\"check\": \"control placed\", \"actual\": 1000, \"expected\": 2000, \"passed\": false}, {\"check\": \"control unplaced\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"boundary dead heat for the win\", \"actual\": 3300, \"expected\": 4300, \"passed\": false}, {\"check\": \"boundary dead heat for last place\", \"actual\": 1000, \"expected\": 1500, \"passed\": false}, {\"check\": \"regression: place odds fraction\", \"actual\": 56, \"expected\": 156, \"passed\": false}, {\"check\": \"variant scenario 1\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"variant scenario 2\", \"actual\": 260, \"expected\": 360, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.296,"exit_code":1,"observations":[{"actual":6250,"check":"control winner","expected":7000,"passed":false},{"actual":1250,"check":"control placed","expected":2000,"passed":false},{"actual":0,"check":"control unplaced","expected":0,"passed":true},{"actual":3500,"check":"boundary dead heat for the win","expected":4300,"passed":false},{"actual":1100,"check":"boundary dead heat for last place","expected":1500,"passed":false},{"actual":76,"check":"regression: place odds fraction","expected":156,"passed":false},{"actual":0,"check":"variant scenario 1","expected":0,"passed":true},{"actual":280,"check":"variant scenario 2","expected":360,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"control winner\", \"actual\": 6250, \"expected\": 7000, \"passed\": false}, {\"check\": \"control placed\", \"actual\": 1250, \"expected\": 2000, \"passed\": false}, {\"check\": \"control unplaced\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"boundary dead heat for the win\", \"actual\": 3500, \"expected\": 4300, \"passed\": false}, {\"check\": \"boundary dead heat for last place\", \"actual\": 1100, \"expected\": 1500, \"passed\": false}, {\"check\": \"regression: place odds fraction\", \"actual\": 76, \"expected\": 156, \"passed\": false}, {\"check\": \"variant scenario 1\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"variant scenario 2\", \"actual\": 280, \"expected\": 360, \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":46.671,"exit_code":0,"observations":[{"actual":7000,"check":"control winner","expected":7000,"passed":true},{"actual":2000,"check":"control placed","expected":2000,"passed":true},{"actual":0,"check":"control unplaced","expected":0,"passed":true},{"actual":4300,"check":"boundary dead heat for the win","expected":4300,"passed":true},{"actual":1500,"check":"boundary dead heat for last place","expected":1500,"passed":true},{"actual":156,"check":"regression: place odds fraction","expected":156,"passed":true},{"actual":0,"check":"variant scenario 1","expected":0,"passed":true},{"actual":360,"check":"variant scenario 2","expected":360,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"control winner\", \"actual\": 7000, \"expected\": 7000, \"passed\": true}, {\"check\": \"control placed\", \"actual\": 2000, \"expected\": 2000, \"passed\": true}, {\"check\": \"control unplaced\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"boundary dead heat for the win\", \"actual\": 4300, \"expected\": 4300, \"passed\": true}, {\"check\": \"boundary dead heat for last place\", \"actual\": 1500, \"expected\": 1500, \"passed\": true}, {\"check\": \"regression: place odds fraction\", \"actual\": 156, \"expected\": 156, \"passed\": true}, {\"check\": \"variant scenario 1\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"variant scenario 2\", \"actual\": 360, \"expected\": 360, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}