FAILURE MAP
← Case archive

FA-84796 / Betting odds conversion / Open access

Acca bonus applied to the whole return or to the stake · case 01

Bonus payouts include a percentage of the stake.

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

ROOT CAUSE

The bonus percentage is applied to stake plus profit.

VERIFIED REPAIR

Apply the bonus to the profit only.

Unsuccessful approach: Adding a percentage of the stake is not a winnings bonus.

Case contract

Winning accumulator bonus. Every leg price multiplies the accumulator. Legs priced at 1.20 or more qualify; the bonus percentage by qualifying count is {3: 5, 4: 10, 5: 15, 6: 20, 7: 25} with 7 or more paying 25 and fewer than 3 paying 0. The bonus is applied to the profit only: return = stake + profit * (100 + pct) / 100, rounded down. Return [qualifying legs, bonus pct, return cents].

Why this case matters

Acca promotions depend on minimum-odds qualification and apply the bonus to winnings.

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(prices, stake_cents):
    TABLE = {3: 5, 4: 10, 5: 15, 6: 20, 7: 25}
    factor = Fraction(1)
    q = 0
    for p in prices:
        d = Fraction(p)
        factor *= d
        if d >= Fraction(120, 100):
            q += 1
    pct = TABLE.get(min(q, 7), 0)
    profit = stake_cents * (factor - 1)
    return [q, pct, math.floor(stake_cents * factor * (100 + pct) / 100)]
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 treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['1.15', '1.15', '1.07', '1.66', '1.15', '1.15', '2.23', '1.69', '1.25'], 1000),
   [4, 10, 15998]),
  ('variant scenario 1',
   (['1.50', '1.19', '1.33', '1.30', '1.19', '1.19', '1.19', '1.19', '1.19'], 500),
   [3, 5, 3841]),
  ('variant scenario 2',
   (['1.20', '1.33', '1.15', '1.20', '1.60', '1.15', '1.37', '1.72'], 500),
   [6, 20, 5629])],
 [('control treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['1.20', '1.25', '1.25', '1.25', '1.56', '1.15', '1.19', '2.16'], 100),
   [6, 20, 1276]),
  ('variant scenario 1', (['1.52', '1.25', '1.20', '1.25'], 100), [4, 10, 303]),
  ('variant scenario 2', (['1.15', '1.19', '1.19', '2.36'], 100), [1, 0, 384])],
 [('control treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['2.25', '2.49', '1.25', '2.47', '1.15', '1.20'], 100),
   [5, 15, 2730]),
  ('variant scenario 1', (['1.15', '1.19', '1.15'], 100), [0, 0, 157]),
  ('variant scenario 2', (['1.15', '1.19', '1.46', '1.20', '1.20', '1.25'], 100), [4, 10, 385])],
 [('control treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['2.37', '1.15', '1.25', '2.10', '1.20', '1.15', '2.72', '2.40', '1.19'], 1000),
   [6, 20, 91837]),
  ('variant scenario 1',
   (['1.54', '1.20', '1.20', '1.36', '1.15', '1.25', '1.32'], 1000),
   [6, 20, 6667]),
  ('variant scenario 2',
   (['1.15', '2.35', '2.91', '1.25', '1.19', '1.25', '1.20', '1.33'], 100),
   [6, 20, 2780])],
 [('control treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['1.15', '1.19', '1.25', '2.20', '2.41', '1.15'], 1000),
   [3, 5, 10901]),
  ('variant scenario 1', (['2.40', '1.19', '1.25'], 500), [2, 0, 1785]),
  ('variant scenario 2', (['1.20', '1.15', '1.20', '1.15'], 1000), [2, 0, 1904])]]
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 treble[3, 5, 840][3, 5, 835]Failed
boundary minimum odds leg[3, 5, 504][3, 5, 499]Failed
boundary short leg does not qualify[2, 0, 476][2, 0, 476]Passed
boundary eight legs capped[8, 25, 3203][8, 25, 3178]Failed
regression: bonus base[4, 10, 16098][4, 10, 15998]Failed
variant scenario 1[3, 5, 3866][3, 5, 3841]Failed
variant scenario 2[6, 20, 5729][6, 20, 5629]Failed

SHA-256 / 720f25171eb14c9c51d221afeb85e723b69b1f5f3c701aae58e8a348143fdbf1

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(prices, stake_cents):
    TABLE = {3: 5, 4: 10, 5: 15, 6: 20, 7: 25}
    factor = Fraction(1)
    q = 0
    for p in prices:
        d = Fraction(p)
        factor *= d
        if d >= Fraction(120, 100):
            q += 1
    pct = TABLE.get(min(q, 7), 0)
    profit = stake_cents * (factor - 1)
    return [q, pct, math.floor(stake_cents + profit + stake_cents * pct / Fraction(100))]
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 treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['1.15', '1.15', '1.07', '1.66', '1.15', '1.15', '2.23', '1.69', '1.25'], 1000),
   [4, 10, 15998]),
  ('variant scenario 1',
   (['1.50', '1.19', '1.33', '1.30', '1.19', '1.19', '1.19', '1.19', '1.19'], 500),
   [3, 5, 3841]),
  ('variant scenario 2',
   (['1.20', '1.33', '1.15', '1.20', '1.60', '1.15', '1.37', '1.72'], 500),
   [6, 20, 5629])],
 [('control treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['1.20', '1.25', '1.25', '1.25', '1.56', '1.15', '1.19', '2.16'], 100),
   [6, 20, 1276]),
  ('variant scenario 1', (['1.52', '1.25', '1.20', '1.25'], 100), [4, 10, 303]),
  ('variant scenario 2', (['1.15', '1.19', '1.19', '2.36'], 100), [1, 0, 384])],
 [('control treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['2.25', '2.49', '1.25', '2.47', '1.15', '1.20'], 100),
   [5, 15, 2730]),
  ('variant scenario 1', (['1.15', '1.19', '1.15'], 100), [0, 0, 157]),
  ('variant scenario 2', (['1.15', '1.19', '1.46', '1.20', '1.20', '1.25'], 100), [4, 10, 385])],
 [('control treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['2.37', '1.15', '1.25', '2.10', '1.20', '1.15', '2.72', '2.40', '1.19'], 1000),
   [6, 20, 91837]),
  ('variant scenario 1',
   (['1.54', '1.20', '1.20', '1.36', '1.15', '1.25', '1.32'], 1000),
   [6, 20, 6667]),
  ('variant scenario 2',
   (['1.15', '2.35', '2.91', '1.25', '1.19', '1.25', '1.20', '1.33'], 100),
   [6, 20, 2780])],
 [('control treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['1.15', '1.19', '1.25', '2.20', '2.41', '1.15'], 1000),
   [3, 5, 10901]),
  ('variant scenario 1', (['2.40', '1.19', '1.25'], 500), [2, 0, 1785]),
  ('variant scenario 2', (['1.20', '1.15', '1.20', '1.15'], 1000), [2, 0, 1904])]]
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 treble[3, 5, 805][3, 5, 835]Failed
boundary minimum odds leg[3, 5, 485][3, 5, 499]Failed
boundary short leg does not qualify[2, 0, 476][2, 0, 476]Passed
boundary eight legs capped[8, 25, 2587][8, 25, 3178]Failed
regression: bonus base[4, 10, 14734][4, 10, 15998]Failed
variant scenario 1[3, 5, 3707][3, 5, 3841]Failed
variant scenario 2[6, 20, 4874][6, 20, 5629]Failed

SHA-256 / 73cc7ffa15299ad9dd30e25a60e74067dbf21fe5282bbd19bb42b704dcfe8086

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(prices, stake_cents):
    TABLE = {3: 5, 4: 10, 5: 15, 6: 20, 7: 25}
    factor = Fraction(1)
    q = 0
    for p in prices:
        d = Fraction(p)
        factor *= d
        if d >= Fraction(120, 100):
            q += 1
    pct = TABLE.get(min(q, 7), 0)
    profit = stake_cents * (factor - 1)
    return [q, pct, math.floor(stake_cents + profit * (100 + pct) / 100)]
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 treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['1.15', '1.15', '1.07', '1.66', '1.15', '1.15', '2.23', '1.69', '1.25'], 1000),
   [4, 10, 15998]),
  ('variant scenario 1',
   (['1.50', '1.19', '1.33', '1.30', '1.19', '1.19', '1.19', '1.19', '1.19'], 500),
   [3, 5, 3841]),
  ('variant scenario 2',
   (['1.20', '1.33', '1.15', '1.20', '1.60', '1.15', '1.37', '1.72'], 500),
   [6, 20, 5629])],
 [('control treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['1.20', '1.25', '1.25', '1.25', '1.56', '1.15', '1.19', '2.16'], 100),
   [6, 20, 1276]),
  ('variant scenario 1', (['1.52', '1.25', '1.20', '1.25'], 100), [4, 10, 303]),
  ('variant scenario 2', (['1.15', '1.19', '1.19', '2.36'], 100), [1, 0, 384])],
 [('control treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['2.25', '2.49', '1.25', '2.47', '1.15', '1.20'], 100),
   [5, 15, 2730]),
  ('variant scenario 1', (['1.15', '1.19', '1.15'], 100), [0, 0, 157]),
  ('variant scenario 2', (['1.15', '1.19', '1.46', '1.20', '1.20', '1.25'], 100), [4, 10, 385])],
 [('control treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['2.37', '1.15', '1.25', '2.10', '1.20', '1.15', '2.72', '2.40', '1.19'], 1000),
   [6, 20, 91837]),
  ('variant scenario 1',
   (['1.54', '1.20', '1.20', '1.36', '1.15', '1.25', '1.32'], 1000),
   [6, 20, 6667]),
  ('variant scenario 2',
   (['1.15', '2.35', '2.91', '1.25', '1.19', '1.25', '1.20', '1.33'], 100),
   [6, 20, 2780])],
 [('control treble', (['2.00', '2.00', '2.00'], 100), [3, 5, 835]),
  ('boundary minimum odds leg', (['1.20', '2.00', '2.00'], 100), [3, 5, 499]),
  ('boundary short leg does not qualify', (['1.19', '2.00', '2.00'], 100), [2, 0, 476]),
  ('boundary eight legs capped',
   (['1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50', '1.50'], 100),
   [8, 25, 3178]),
  ('regression: bonus base',
   (['1.15', '1.19', '1.25', '2.20', '2.41', '1.15'], 1000),
   [3, 5, 10901]),
  ('variant scenario 1', (['2.40', '1.19', '1.25'], 500), [2, 0, 1785]),
  ('variant scenario 2', (['1.20', '1.15', '1.20', '1.15'], 1000), [2, 0, 1904])]]
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 treble[3, 5, 835][3, 5, 835]Passed
boundary minimum odds leg[3, 5, 499][3, 5, 499]Passed
boundary short leg does not qualify[2, 0, 476][2, 0, 476]Passed
boundary eight legs capped[8, 25, 3178][8, 25, 3178]Passed
regression: bonus base[4, 10, 15998][4, 10, 15998]Passed
variant scenario 1[3, 5, 3841][3, 5, 3841]Passed
variant scenario 2[6, 20, 5629][6, 20, 5629]Passed

SHA-256 / 8ee22533bacd62e40aad5ec3bfc450a6405201c57ada921b73af9cc7665e9ad0

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

Case digest / 9243969905d2844b2cd42a2c55ad250c08719e72dc867eb7b7f9f2d5df7b8853