FAILURE MAP
← Case archive

FA-84496 / Betting odds conversion / Open access

Place dead-heat reduction ignores how many places remain · case 01

Runners dead-heating for a place fully inside the places are cut, or those straddling the last place are not.

Verified by executionVariant 1 · 9 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The place stake is always divided by the dead-heat count.

THE FAILURE

The place stake is always divided by the dead-heat count.

Unsuccessful approach: Ignoring the dead heat for the place part overpays runners tied for the last place.

Case 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.

Why this case matters

Horse-racing settlement applies place terms and dead-heat reductions to each part separately.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(stake_cents, odds, terms, position, places_paid, dead_heat):
    a, b = map(int, odds.split('/'))
    f = Fraction(a, b)
    tn, td = map(int, terms.split('/'))
    place_f = f * Fraction(tn, td)
    ret = Fraction(0)
    if position == 1:
        ret += Fraction(stake_cents, dead_heat) * (1 + f)
    if position <= places_paid:
        share = Fraction(1, dead_heat)
        ret += stake_cents * share * (1 + place_f)
    return math.floor(ret)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),
  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),
  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),
  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),
  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),
  ('regression: place dead heat share', (250, '4/2', '1/4', 3, 3, 2), 187),
  ('regression: place dead heat share', (100, '8/2', '1/5', 4, 5, 2), 180),
  ('variant scenario 1', (500, '6/1', '1/5', 2, 2, 1), 1100),
  ('variant scenario 2', (100, '21/2', '1/4', 4, 2, 1), 0)],
 [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),
  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),
  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),
  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),
  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),
  ('regression: place dead heat share', (1000, '4/1', '1/5', 1, 3, 2), 4300),
  ('regression: place dead heat share', (500, '28/1', '1/4', 3, 3, 2), 2000),
  ('variant scenario 1', (1000, '25/2', '1/5', 4, 2, 2), 0),
  ('variant scenario 2', (1000, '22/5', '1/5', 6, 4, 3), 0)],
 [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),
  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),
  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),
  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),
  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),
  ('regression: place dead heat share', (500, '27/5', '1/4', 4, 4, 2), 587),
  ('regression: place dead heat share', (1000, '5/1', '1/5', 1, 5, 3), 4000),
  ('variant scenario 1', (1000, '18/5', '1/5', 2, 4, 1), 1720),
  ('variant scenario 2', (500, '16/1', '1/5', 1, 3, 1), 10600)],
 [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),
  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),
  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),
  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),
  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),
  ('regression: place dead heat share', (250, '15/1', '1/4', 1, 5, 2), 3187),
  ('regression: place dead heat share', (500, '18/2', '1/5', 2, 2, 2), 700),
  ('variant scenario 1', (100, '1/2', '1/5', 2, 2, 1), 110),
  ('variant scenario 2', (250, '17/4', '1/4', 3, 3, 1), 515)],
 [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),
  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),
  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),
  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),
  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),
  ('regression: place dead heat share', (1000, '2/5', '1/4', 1, 3, 2), 1800),
  ('regression: place dead heat share', (100, '18/4', '1/5', 4, 5, 3), 126),
  ('variant scenario 1', (250, '26/1', '1/5', 1, 3, 2), 4925),
  ('variant scenario 2', (1000, '21/1', '1/5', 2, 4, 3), 5200)]]
for label, args, expected in cases[N - 1]:
    check(label, run(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
control winner70007000Passed
control placed20002000Passed
control unplaced00Passed
boundary dead heat for the win34004300Failed
boundary dead heat for last place15001500Passed
regression: place dead heat share187187Passed
regression: place dead heat share90180Failed
variant scenario 111001100Passed
variant scenario 200Passed

SHA-256 / d709aaf1b3d68724447ab36868faca6d1adef4d8627ea964b2e49ce0c73f6cd0

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(stake_cents, odds, terms, position, places_paid, dead_heat):
    a, b = map(int, odds.split('/'))
    f = Fraction(a, b)
    tn, td = map(int, terms.split('/'))
    place_f = f * Fraction(tn, td)
    ret = Fraction(0)
    if position == 1:
        ret += Fraction(stake_cents, dead_heat) * (1 + f)
    if position <= places_paid:
        share = Fraction(1)
        ret += stake_cents * share * (1 + place_f)
    return math.floor(ret)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),
  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),
  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),
  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),
  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),
  ('regression: place dead heat share', (250, '4/2', '1/4', 3, 3, 2), 187),
  ('regression: place dead heat share', (100, '8/2', '1/5', 4, 5, 2), 180),
  ('variant scenario 1', (500, '6/1', '1/5', 2, 2, 1), 1100),
  ('variant scenario 2', (100, '21/2', '1/4', 4, 2, 1), 0)],
 [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),
  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),
  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),
  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),
  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),
  ('regression: place dead heat share', (1000, '4/1', '1/5', 1, 3, 2), 4300),
  ('regression: place dead heat share', (500, '28/1', '1/4', 3, 3, 2), 2000),
  ('variant scenario 1', (1000, '25/2', '1/5', 4, 2, 2), 0),
  ('variant scenario 2', (1000, '22/5', '1/5', 6, 4, 3), 0)],
 [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),
  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),
  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),
  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),
  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),
  ('regression: place dead heat share', (500, '27/5', '1/4', 4, 4, 2), 587),
  ('regression: place dead heat share', (1000, '5/1', '1/5', 1, 5, 3), 4000),
  ('variant scenario 1', (1000, '18/5', '1/5', 2, 4, 1), 1720),
  ('variant scenario 2', (500, '16/1', '1/5', 1, 3, 1), 10600)],
 [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),
  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),
  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),
  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),
  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),
  ('regression: place dead heat share', (250, '15/1', '1/4', 1, 5, 2), 3187),
  ('regression: place dead heat share', (500, '18/2', '1/5', 2, 2, 2), 700),
  ('variant scenario 1', (100, '1/2', '1/5', 2, 2, 1), 110),
  ('variant scenario 2', (250, '17/4', '1/4', 3, 3, 1), 515)],
 [('control winner', (1000, '4/1', '1/4', 1, 3, 1), 7000),
  ('control placed', (1000, '4/1', '1/4', 2, 3, 1), 2000),
  ('control unplaced', (1000, '4/1', '1/4', 4, 3, 1), 0),
  ('boundary dead heat for the win', (1000, '4/1', '1/5', 1, 3, 2), 4300),
  ('boundary dead heat for last place', (1000, '10/1', '1/5', 3, 3, 2), 1500),
  ('regression: place dead heat share', (1000, '2/5', '1/4', 1, 3, 2), 1800),
  ('regression: place dead heat share', (100, '18/4', '1/5', 4, 5, 3), 126),
  ('variant scenario 1', (250, '26/1', '1/5', 1, 3, 2), 4925),
  ('variant scenario 2', (1000, '21/1', '1/5', 2, 4, 3), 5200)]]
for label, args, expected in cases[N - 1]:
    check(label, run(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
control winner70007000Passed
control placed20002000Passed
control unplaced00Passed
boundary dead heat for the win43004300Passed
boundary dead heat for last place30001500Failed
regression: place dead heat share375187Failed
regression: place dead heat share180180Passed
variant scenario 111001100Passed
variant scenario 200Passed

SHA-256 / 03a27c7ed0904cea3497d645bcc964b106fadc7b992ee79cdd28b9eff056290b

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 9 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

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.

Observations recorded using Python 3.12.14 at 2026-09-29T14:50:31.402899+00:00.

Case digest / 6b9d44553ae17da8d57444cd3370e49e136a8fc765dd27ad68a1d6ed0cc44977