FAILURE MAP
← Case archive

FA-84506 / Betting odds conversion / Open access

Quarter line split into the wrong neighbouring lines · case 01

A -0.25 bet on a draw is settled as a full loss or a full push.

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

ROOT CAUSE

The quarter line is split into line - 0.5 and line + 0.5.

VERIFIED REPAIR

Split into line - 0.25 and line + 0.25.

Unsuccessful approach: Splitting into the line itself and line + 0.25 prices half the stake on an off-grid line.

Case contract

Asian handicap bet on the home side. line is a multiple of 0.25 (else "invalid line"). Whole and half lines are a single bet; quarter lines split the stake equally between line - 0.25 and line + 0.25. Each part: margin = home_goals - away_goals + part_line; positive wins stake_part * price, zero refunds stake_part, negative loses. Return [total return in cents rounded down, label] where the label is win, half-win, push, half-lose or lose from the summed part outcomes.

Why this case matters

Asian handicap settlement with split quarter lines is a common source of payout disputes.

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(line, home_goals, away_goals, stake_cents, price):
    L = Fraction(line)
    if (L * 4).denominator != 1:
        return 'invalid line'
    if (L * 2).denominator == 1:
        parts = [L]
    else:
        parts = [L - Fraction(1, 2), L + Fraction(1, 2)]
    d = Fraction(price)
    share = Fraction(stake_cents, len(parts))
    ret = Fraction(0)
    res = []
    for p in parts:
        m = home_goals - away_goals + p
        if m > 0:
            ret += share * d
            res.append(1)
        elif m == 0:
            ret += share
            res.append(0)
        else:
            res.append(-1)
    score = sum(res) * 2 // len(parts)
    label = {2: 'win', 1: 'half-win', 0: 'push', -1: 'half-lose', -2: 'lose'}[score]
    return [math.floor(ret), label]
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 half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('-1.75', 4, 2, 500, '2.00'), [750, 'half-win']),
  ('variant scenario 1', ('-0.75', 3, 1, 250, '2.00'), [500, 'win']),
  ('variant scenario 2', ('+0.75', 4, 1, 250, '2.05'), [512, 'win'])],
 [('control half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('-0.25', 2, 2, 999, '2.00'), [499, 'half-lose']),
  ('regression: quarter split offsets', ('+1.25', 3, 4, 500, '2.05'), [762, 'half-win']),
  ('variant scenario 1', ('0', 3, 3, 999, '2.05'), [999, 'push']),
  ('variant scenario 2', ('-0.5', 3, 1, 500, '2.00'), [1000, 'win'])],
 [('control half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('+1.25', 2, 3, 500, '2.00'), [750, 'half-win']),
  ('variant scenario 1', ('-1.5', 2, 2, 500, '1.85'), [0, 'lose']),
  ('variant scenario 2', ('+2', 4, 1, 999, '2.05'), [2047, 'win'])],
 [('control half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('-0.75', 4, 3, 500, '2.00'), [750, 'half-win']),
  ('variant scenario 1', ('+0.25', 3, 0, 999, '2.05'), [2047, 'win']),
  ('variant scenario 2', ('-1.5', 3, 3, 500, '2.00'), [0, 'lose'])],
 [('control half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('variant scenario 1', ('+0.5', 1, 3, 999, '2.00'), [0, 'lose']),
  ('variant scenario 2', ('+2', 1, 1, 250, '2.05'), [512, 'win'])]]
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 half line win[1900, 'win'][1900, 'win']Passed
boundary whole line push[1000, 'push'][1000, 'push']Passed
boundary quarter half-lose[950, 'push'][500, 'half-lose']Failed
boundary quarter half-win[1000, 'push'][1500, 'half-win']Failed
control lose[0, 'lose'][0, 'lose']Passed
boundary off-grid lineinvalid lineinvalid linePassed
regression: quarter split offsets[500, 'push'][750, 'half-win']Failed
variant scenario 1[500, 'win'][500, 'win']Passed
variant scenario 2[512, 'win'][512, 'win']Passed

SHA-256 / 926f6280174ce9f2f3b4709433c85a32072e95f3214ce424777a855b3a616d91

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(line, home_goals, away_goals, stake_cents, price):
    L = Fraction(line)
    if (L * 4).denominator != 1:
        return 'invalid line'
    if (L * 2).denominator == 1:
        parts = [L]
    else:
        parts = [L, L + Fraction(1, 4)]
    d = Fraction(price)
    share = Fraction(stake_cents, len(parts))
    ret = Fraction(0)
    res = []
    for p in parts:
        m = home_goals - away_goals + p
        if m > 0:
            ret += share * d
            res.append(1)
        elif m == 0:
            ret += share
            res.append(0)
        else:
            res.append(-1)
    score = sum(res) * 2 // len(parts)
    label = {2: 'win', 1: 'half-win', 0: 'push', -1: 'half-lose', -2: 'lose'}[score]
    return [math.floor(ret), label]
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 half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('-1.75', 4, 2, 500, '2.00'), [750, 'half-win']),
  ('variant scenario 1', ('-0.75', 3, 1, 250, '2.00'), [500, 'win']),
  ('variant scenario 2', ('+0.75', 4, 1, 250, '2.05'), [512, 'win'])],
 [('control half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('-0.25', 2, 2, 999, '2.00'), [499, 'half-lose']),
  ('regression: quarter split offsets', ('+1.25', 3, 4, 500, '2.05'), [762, 'half-win']),
  ('variant scenario 1', ('0', 3, 3, 999, '2.05'), [999, 'push']),
  ('variant scenario 2', ('-0.5', 3, 1, 500, '2.00'), [1000, 'win'])],
 [('control half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('+1.25', 2, 3, 500, '2.00'), [750, 'half-win']),
  ('variant scenario 1', ('-1.5', 2, 2, 500, '1.85'), [0, 'lose']),
  ('variant scenario 2', ('+2', 4, 1, 999, '2.05'), [2047, 'win'])],
 [('control half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('-0.75', 4, 3, 500, '2.00'), [750, 'half-win']),
  ('variant scenario 1', ('+0.25', 3, 0, 999, '2.05'), [2047, 'win']),
  ('variant scenario 2', ('-1.5', 3, 3, 500, '2.00'), [0, 'lose'])],
 [('control half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('variant scenario 1', ('+0.5', 1, 3, 999, '2.00'), [0, 'lose']),
  ('variant scenario 2', ('+2', 1, 1, 250, '2.05'), [512, 'win'])]]
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 half line win[1900, 'win'][1900, 'win']Passed
boundary whole line push[1000, 'push'][1000, 'push']Passed
boundary quarter half-lose[500, 'half-lose'][500, 'half-lose']Passed
boundary quarter half-win[2000, 'win'][1500, 'half-win']Failed
control lose[0, 'lose'][0, 'lose']Passed
boundary off-grid lineinvalid lineinvalid linePassed
regression: quarter split offsets[1000, 'win'][750, 'half-win']Failed
variant scenario 1[500, 'win'][500, 'win']Passed
variant scenario 2[512, 'win'][512, 'win']Passed

SHA-256 / 28e89480a869a587a668542f0758aae57059b12052c40afb914935ed61b46bab

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(line, home_goals, away_goals, stake_cents, price):
    L = Fraction(line)
    if (L * 4).denominator != 1:
        return 'invalid line'
    if (L * 2).denominator == 1:
        parts = [L]
    else:
        parts = [L - Fraction(1, 4), L + Fraction(1, 4)]
    d = Fraction(price)
    share = Fraction(stake_cents, len(parts))
    ret = Fraction(0)
    res = []
    for p in parts:
        m = home_goals - away_goals + p
        if m > 0:
            ret += share * d
            res.append(1)
        elif m == 0:
            ret += share
            res.append(0)
        else:
            res.append(-1)
    score = sum(res) * 2 // len(parts)
    label = {2: 'win', 1: 'half-win', 0: 'push', -1: 'half-lose', -2: 'lose'}[score]
    return [math.floor(ret), label]
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 half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('-1.75', 4, 2, 500, '2.00'), [750, 'half-win']),
  ('variant scenario 1', ('-0.75', 3, 1, 250, '2.00'), [500, 'win']),
  ('variant scenario 2', ('+0.75', 4, 1, 250, '2.05'), [512, 'win'])],
 [('control half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('-0.25', 2, 2, 999, '2.00'), [499, 'half-lose']),
  ('regression: quarter split offsets', ('+1.25', 3, 4, 500, '2.05'), [762, 'half-win']),
  ('variant scenario 1', ('0', 3, 3, 999, '2.05'), [999, 'push']),
  ('variant scenario 2', ('-0.5', 3, 1, 500, '2.00'), [1000, 'win'])],
 [('control half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('+1.25', 2, 3, 500, '2.00'), [750, 'half-win']),
  ('variant scenario 1', ('-1.5', 2, 2, 500, '1.85'), [0, 'lose']),
  ('variant scenario 2', ('+2', 4, 1, 999, '2.05'), [2047, 'win'])],
 [('control half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('-0.75', 4, 3, 500, '2.00'), [750, 'half-win']),
  ('variant scenario 1', ('+0.25', 3, 0, 999, '2.05'), [2047, 'win']),
  ('variant scenario 2', ('-1.5', 3, 3, 500, '2.00'), [0, 'lose'])],
 [('control half line win', ('-0.5', 1, 0, 1000, '1.90'), [1900, 'win']),
  ('boundary whole line push', ('-1', 2, 1, 1000, '1.90'), [1000, 'push']),
  ('boundary quarter half-lose', ('-0.25', 1, 1, 1000, '1.90'), [500, 'half-lose']),
  ('boundary quarter half-win', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('control lose', ('+0.5', 0, 2, 1000, '1.90'), [0, 'lose']),
  ('boundary off-grid line', ('-0.3', 1, 0, 1000, '1.90'), 'invalid line'),
  ('regression: quarter split offsets', ('-0.75', 1, 0, 1000, '2.00'), [1500, 'half-win']),
  ('variant scenario 1', ('+0.5', 1, 3, 999, '2.00'), [0, 'lose']),
  ('variant scenario 2', ('+2', 1, 1, 250, '2.05'), [512, 'win'])]]
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 half line win[1900, 'win'][1900, 'win']Passed
boundary whole line push[1000, 'push'][1000, 'push']Passed
boundary quarter half-lose[500, 'half-lose'][500, 'half-lose']Passed
boundary quarter half-win[1500, 'half-win'][1500, 'half-win']Passed
control lose[0, 'lose'][0, 'lose']Passed
boundary off-grid lineinvalid lineinvalid linePassed
regression: quarter split offsets[750, 'half-win'][750, 'half-win']Passed
variant scenario 1[500, 'win'][500, 'win']Passed
variant scenario 2[512, 'win'][512, 'win']Passed

SHA-256 / 7923f730831af7a386ae1665f4985e47a2a8ab5a5f25cf6acf1bf2b4898a0bbd

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.577015+00:00.

Case digest / 574446184006fba2ea12612ba0fa9b7eb13c5503489e4bcb2a8b60147cf979df