FA-86001 / Game economy crafting balance / Open access
Repair bill: Over-repaired items credit the bill · case 01
Items above maximum durability reduce the cost of other repairs.
ROOT CAUSE
Missing durability is not clamped at zero.
VERIFIED REPAIR
Restore `max(0, it['max'] - it['dur'])` at the missing durability clamp step.
Unsuccessful approach: Taking the absolute value charges for durability that is not missing.
Case contract
Per item cost = max(0, max-dur) * (ilvl//4 + 1) copper. Discount percentages stack multiplicatively on the exact total; the result is rounded up once to copper. Return [gold, silver, copper] with 100 copper per silver and 100 silver per gold.
Why this case matters
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.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(items, discounts):
total = 0
for it in items:
missing = it['max'] - it['dur']
total += missing * (it['ilvl'] // 4 + 1)
price = Fraction(total)
for pct in discounts:
price = price * (100 - pct) / 100
cost = math.ceil(price)
return [cost // 10000, cost // 100 % 100, cost % 100]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1',
[[{'ilvl': 4, 'dur': 63, 'max': 60},
{'ilvl': 130, 'dur': 63, 'max': 60},
{'ilvl': 3, 'dur': 60, 'max': 60}],
[25, 25]],
[0, 0, 0]),
('regression missing durability clamp #2', [[{'ilvl': 111, 'dur': 123, 'max': 120}], []], [0, 0, 0]),
('regression missing durability clamp #3',
[[{'ilvl': 113, 'dur': 123, 'max': 120}, {'ilvl': 8, 'dur': 103, 'max': 100}], []],
[0, 0, 0]),
('regression missing durability clamp #4',
[[{'ilvl': 69, 'dur': 5, 'max': 40},
{'ilvl': 3, 'dur': 49, 'max': 120},
{'ilvl': 139, 'dur': 63, 'max': 60}],
[15]],
[0, 5, 96]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1', [[{'ilvl': 7, 'dur': 40, 'max': 40}], [20]], [0, 0, 0])],
[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1', [[{'ilvl': 111, 'dur': 123, 'max': 120}], []], [0, 0, 0]),
('regression missing durability clamp #2',
[[{'ilvl': 113, 'dur': 123, 'max': 120}, {'ilvl': 8, 'dur': 103, 'max': 100}], []],
[0, 0, 0]),
('regression missing durability clamp #3',
[[{'ilvl': 69, 'dur': 5, 'max': 40},
{'ilvl': 3, 'dur': 49, 'max': 120},
{'ilvl': 139, 'dur': 63, 'max': 60}],
[15]],
[0, 5, 96]),
('regression missing durability clamp #4',
[[{'ilvl': 1, 'dur': 123, 'max': 120},
{'ilvl': 7, 'dur': 61, 'max': 120},
{'ilvl': 3, 'dur': 120, 'max': 120},
{'ilvl': 374, 'dur': 38, 'max': 100}],
[]],
[0, 59, 46]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1', [[{'ilvl': 7, 'dur': 40, 'max': 40}], [20]], [0, 0, 0])],
[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1',
[[{'ilvl': 69, 'dur': 5, 'max': 40},
{'ilvl': 3, 'dur': 49, 'max': 120},
{'ilvl': 139, 'dur': 63, 'max': 60}],
[15]],
[0, 5, 96]),
('regression missing durability clamp #2',
[[{'ilvl': 1, 'dur': 123, 'max': 120},
{'ilvl': 7, 'dur': 61, 'max': 120},
{'ilvl': 3, 'dur': 120, 'max': 120},
{'ilvl': 374, 'dur': 38, 'max': 100}],
[]],
[0, 59, 46]),
('regression missing durability clamp #3', [[{'ilvl': 1, 'dur': 63, 'max': 60}], []], [0, 0, 0]),
('regression missing durability clamp #4',
[[{'ilvl': 8, 'dur': 103, 'max': 100}, {'ilvl': 204, 'dur': 26, 'max': 60}], []],
[0, 17, 68]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1', [[{'ilvl': 7, 'dur': 40, 'max': 40}], [20]], [0, 0, 0])],
[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1', [[{'ilvl': 1, 'dur': 63, 'max': 60}], []], [0, 0, 0]),
('regression missing durability clamp #2',
[[{'ilvl': 8, 'dur': 103, 'max': 100}, {'ilvl': 204, 'dur': 26, 'max': 60}], []],
[0, 17, 68]),
('regression missing durability clamp #3',
[[{'ilvl': 1, 'dur': 123, 'max': 120}, {'ilvl': 1, 'dur': 123, 'max': 120}], [15]],
[0, 0, 0]),
('regression missing durability clamp #4', [[{'ilvl': 1, 'dur': 123, 'max': 120}], [25, 20]], [0, 0, 0]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1',
[[{'ilvl': 8, 'dur': 18, 'max': 120}, {'ilvl': 3, 'dur': 41, 'max': 60}], [20]],
[0, 2, 60])],
[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1',
[[{'ilvl': 1, 'dur': 123, 'max': 120}, {'ilvl': 1, 'dur': 123, 'max': 120}], [15]],
[0, 0, 0]),
('regression missing durability clamp #2', [[{'ilvl': 1, 'dur': 123, 'max': 120}], [25, 20]], [0, 0, 0]),
('regression missing durability clamp #3',
[[{'ilvl': 8, 'dur': 63, 'max': 60}, {'ilvl': 3, 'dur': 43, 'max': 40}], []],
[0, 0, 0]),
('regression missing durability clamp #4',
[[{'ilvl': 346, 'dur': 120, 'max': 120},
{'ilvl': 3, 'dur': 100, 'max': 100},
{'ilvl': 1, 'dur': 103, 'max': 100},
{'ilvl': 7, 'dur': 43, 'max': 40}],
[]],
[0, 0, 0]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1',
[[{'ilvl': 1, 'dur': 120, 'max': 120},
{'ilvl': 4, 'dur': 84, 'max': 100},
{'ilvl': 3, 'dur': 40, 'max': 40},
{'ilvl': 3, 'dur': 0, 'max': 120}],
[10, 33]],
[0, 0, 92])]]
for label, args, expected in cases[N-1]:
check(label, solve(*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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| over-repaired piece #1 | [0, 0, 30] | [0, 0, 60] | Failed |
| regression missing durability clamp #1 | [-1, 99, 41] | [0, 0, 0] | Failed |
| regression missing durability clamp #2 | [-1, 99, 16] | [0, 0, 0] | Failed |
| regression missing durability clamp #3 | [-1, 99, 4] | [0, 0, 0] | Failed |
| regression missing durability clamp #4 | [0, 5, 7] | [0, 5, 96] | Failed |
| two stacked discounts #1 | [0, 22, 47] | [0, 22, 47] | Passed |
| nothing to repair #1 | [0, 0, 0] | [0, 0, 0] | Passed |
| control #1 | [0, 0, 0] | [0, 0, 0] | Passed |
SHA-256 / c2ca76cc3f72627d70033bdf0db33c73c30f276e8089c65fe62986776f8b51d3
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(items, discounts):
total = 0
for it in items:
missing = abs(it['max'] - it['dur'])
total += missing * (it['ilvl'] // 4 + 1)
price = Fraction(total)
for pct in discounts:
price = price * (100 - pct) / 100
cost = math.ceil(price)
return [cost // 10000, cost // 100 % 100, cost % 100]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1',
[[{'ilvl': 4, 'dur': 63, 'max': 60},
{'ilvl': 130, 'dur': 63, 'max': 60},
{'ilvl': 3, 'dur': 60, 'max': 60}],
[25, 25]],
[0, 0, 0]),
('regression missing durability clamp #2', [[{'ilvl': 111, 'dur': 123, 'max': 120}], []], [0, 0, 0]),
('regression missing durability clamp #3',
[[{'ilvl': 113, 'dur': 123, 'max': 120}, {'ilvl': 8, 'dur': 103, 'max': 100}], []],
[0, 0, 0]),
('regression missing durability clamp #4',
[[{'ilvl': 69, 'dur': 5, 'max': 40},
{'ilvl': 3, 'dur': 49, 'max': 120},
{'ilvl': 139, 'dur': 63, 'max': 60}],
[15]],
[0, 5, 96]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1', [[{'ilvl': 7, 'dur': 40, 'max': 40}], [20]], [0, 0, 0])],
[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1', [[{'ilvl': 111, 'dur': 123, 'max': 120}], []], [0, 0, 0]),
('regression missing durability clamp #2',
[[{'ilvl': 113, 'dur': 123, 'max': 120}, {'ilvl': 8, 'dur': 103, 'max': 100}], []],
[0, 0, 0]),
('regression missing durability clamp #3',
[[{'ilvl': 69, 'dur': 5, 'max': 40},
{'ilvl': 3, 'dur': 49, 'max': 120},
{'ilvl': 139, 'dur': 63, 'max': 60}],
[15]],
[0, 5, 96]),
('regression missing durability clamp #4',
[[{'ilvl': 1, 'dur': 123, 'max': 120},
{'ilvl': 7, 'dur': 61, 'max': 120},
{'ilvl': 3, 'dur': 120, 'max': 120},
{'ilvl': 374, 'dur': 38, 'max': 100}],
[]],
[0, 59, 46]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1', [[{'ilvl': 7, 'dur': 40, 'max': 40}], [20]], [0, 0, 0])],
[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1',
[[{'ilvl': 69, 'dur': 5, 'max': 40},
{'ilvl': 3, 'dur': 49, 'max': 120},
{'ilvl': 139, 'dur': 63, 'max': 60}],
[15]],
[0, 5, 96]),
('regression missing durability clamp #2',
[[{'ilvl': 1, 'dur': 123, 'max': 120},
{'ilvl': 7, 'dur': 61, 'max': 120},
{'ilvl': 3, 'dur': 120, 'max': 120},
{'ilvl': 374, 'dur': 38, 'max': 100}],
[]],
[0, 59, 46]),
('regression missing durability clamp #3', [[{'ilvl': 1, 'dur': 63, 'max': 60}], []], [0, 0, 0]),
('regression missing durability clamp #4',
[[{'ilvl': 8, 'dur': 103, 'max': 100}, {'ilvl': 204, 'dur': 26, 'max': 60}], []],
[0, 17, 68]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1', [[{'ilvl': 7, 'dur': 40, 'max': 40}], [20]], [0, 0, 0])],
[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1', [[{'ilvl': 1, 'dur': 63, 'max': 60}], []], [0, 0, 0]),
('regression missing durability clamp #2',
[[{'ilvl': 8, 'dur': 103, 'max': 100}, {'ilvl': 204, 'dur': 26, 'max': 60}], []],
[0, 17, 68]),
('regression missing durability clamp #3',
[[{'ilvl': 1, 'dur': 123, 'max': 120}, {'ilvl': 1, 'dur': 123, 'max': 120}], [15]],
[0, 0, 0]),
('regression missing durability clamp #4', [[{'ilvl': 1, 'dur': 123, 'max': 120}], [25, 20]], [0, 0, 0]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1',
[[{'ilvl': 8, 'dur': 18, 'max': 120}, {'ilvl': 3, 'dur': 41, 'max': 60}], [20]],
[0, 2, 60])],
[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1',
[[{'ilvl': 1, 'dur': 123, 'max': 120}, {'ilvl': 1, 'dur': 123, 'max': 120}], [15]],
[0, 0, 0]),
('regression missing durability clamp #2', [[{'ilvl': 1, 'dur': 123, 'max': 120}], [25, 20]], [0, 0, 0]),
('regression missing durability clamp #3',
[[{'ilvl': 8, 'dur': 63, 'max': 60}, {'ilvl': 3, 'dur': 43, 'max': 40}], []],
[0, 0, 0]),
('regression missing durability clamp #4',
[[{'ilvl': 346, 'dur': 120, 'max': 120},
{'ilvl': 3, 'dur': 100, 'max': 100},
{'ilvl': 1, 'dur': 103, 'max': 100},
{'ilvl': 7, 'dur': 43, 'max': 40}],
[]],
[0, 0, 0]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1',
[[{'ilvl': 1, 'dur': 120, 'max': 120},
{'ilvl': 4, 'dur': 84, 'max': 100},
{'ilvl': 3, 'dur': 40, 'max': 40},
{'ilvl': 3, 'dur': 0, 'max': 120}],
[10, 33]],
[0, 0, 92])]]
for label, args, expected in cases[N-1]:
check(label, solve(*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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| over-repaired piece #1 | [0, 0, 90] | [0, 0, 60] | Failed |
| regression missing durability clamp #1 | [0, 0, 60] | [0, 0, 0] | Failed |
| regression missing durability clamp #2 | [0, 0, 84] | [0, 0, 0] | Failed |
| regression missing durability clamp #3 | [0, 0, 96] | [0, 0, 0] | Failed |
| regression missing durability clamp #4 | [0, 6, 86] | [0, 5, 96] | Failed |
| two stacked discounts #1 | [0, 22, 47] | [0, 22, 47] | Passed |
| nothing to repair #1 | [0, 0, 0] | [0, 0, 0] | Passed |
| control #1 | [0, 0, 0] | [0, 0, 0] | Passed |
SHA-256 / fbdab3d96118de4e32f00411796cdf5f9af45e9591b1577ca562120d0dc39d23
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(items, discounts):
total = 0
for it in items:
missing = max(0, it['max'] - it['dur'])
total += missing * (it['ilvl'] // 4 + 1)
price = Fraction(total)
for pct in discounts:
price = price * (100 - pct) / 100
cost = math.ceil(price)
return [cost // 10000, cost // 100 % 100, cost % 100]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1',
[[{'ilvl': 4, 'dur': 63, 'max': 60},
{'ilvl': 130, 'dur': 63, 'max': 60},
{'ilvl': 3, 'dur': 60, 'max': 60}],
[25, 25]],
[0, 0, 0]),
('regression missing durability clamp #2', [[{'ilvl': 111, 'dur': 123, 'max': 120}], []], [0, 0, 0]),
('regression missing durability clamp #3',
[[{'ilvl': 113, 'dur': 123, 'max': 120}, {'ilvl': 8, 'dur': 103, 'max': 100}], []],
[0, 0, 0]),
('regression missing durability clamp #4',
[[{'ilvl': 69, 'dur': 5, 'max': 40},
{'ilvl': 3, 'dur': 49, 'max': 120},
{'ilvl': 139, 'dur': 63, 'max': 60}],
[15]],
[0, 5, 96]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1', [[{'ilvl': 7, 'dur': 40, 'max': 40}], [20]], [0, 0, 0])],
[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1', [[{'ilvl': 111, 'dur': 123, 'max': 120}], []], [0, 0, 0]),
('regression missing durability clamp #2',
[[{'ilvl': 113, 'dur': 123, 'max': 120}, {'ilvl': 8, 'dur': 103, 'max': 100}], []],
[0, 0, 0]),
('regression missing durability clamp #3',
[[{'ilvl': 69, 'dur': 5, 'max': 40},
{'ilvl': 3, 'dur': 49, 'max': 120},
{'ilvl': 139, 'dur': 63, 'max': 60}],
[15]],
[0, 5, 96]),
('regression missing durability clamp #4',
[[{'ilvl': 1, 'dur': 123, 'max': 120},
{'ilvl': 7, 'dur': 61, 'max': 120},
{'ilvl': 3, 'dur': 120, 'max': 120},
{'ilvl': 374, 'dur': 38, 'max': 100}],
[]],
[0, 59, 46]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1', [[{'ilvl': 7, 'dur': 40, 'max': 40}], [20]], [0, 0, 0])],
[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1',
[[{'ilvl': 69, 'dur': 5, 'max': 40},
{'ilvl': 3, 'dur': 49, 'max': 120},
{'ilvl': 139, 'dur': 63, 'max': 60}],
[15]],
[0, 5, 96]),
('regression missing durability clamp #2',
[[{'ilvl': 1, 'dur': 123, 'max': 120},
{'ilvl': 7, 'dur': 61, 'max': 120},
{'ilvl': 3, 'dur': 120, 'max': 120},
{'ilvl': 374, 'dur': 38, 'max': 100}],
[]],
[0, 59, 46]),
('regression missing durability clamp #3', [[{'ilvl': 1, 'dur': 63, 'max': 60}], []], [0, 0, 0]),
('regression missing durability clamp #4',
[[{'ilvl': 8, 'dur': 103, 'max': 100}, {'ilvl': 204, 'dur': 26, 'max': 60}], []],
[0, 17, 68]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1', [[{'ilvl': 7, 'dur': 40, 'max': 40}], [20]], [0, 0, 0])],
[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1', [[{'ilvl': 1, 'dur': 63, 'max': 60}], []], [0, 0, 0]),
('regression missing durability clamp #2',
[[{'ilvl': 8, 'dur': 103, 'max': 100}, {'ilvl': 204, 'dur': 26, 'max': 60}], []],
[0, 17, 68]),
('regression missing durability clamp #3',
[[{'ilvl': 1, 'dur': 123, 'max': 120}, {'ilvl': 1, 'dur': 123, 'max': 120}], [15]],
[0, 0, 0]),
('regression missing durability clamp #4', [[{'ilvl': 1, 'dur': 123, 'max': 120}], [25, 20]], [0, 0, 0]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1',
[[{'ilvl': 8, 'dur': 18, 'max': 120}, {'ilvl': 3, 'dur': 41, 'max': 60}], [20]],
[0, 2, 60])],
[('over-repaired piece #1',
[[{'ilvl': 20, 'dur': 105, 'max': 100}, {'ilvl': 20, 'dur': 90, 'max': 100}], []],
[0, 0, 60]),
('regression missing durability clamp #1',
[[{'ilvl': 1, 'dur': 123, 'max': 120}, {'ilvl': 1, 'dur': 123, 'max': 120}], [15]],
[0, 0, 0]),
('regression missing durability clamp #2', [[{'ilvl': 1, 'dur': 123, 'max': 120}], [25, 20]], [0, 0, 0]),
('regression missing durability clamp #3',
[[{'ilvl': 8, 'dur': 63, 'max': 60}, {'ilvl': 3, 'dur': 43, 'max': 40}], []],
[0, 0, 0]),
('regression missing durability clamp #4',
[[{'ilvl': 346, 'dur': 120, 'max': 120},
{'ilvl': 3, 'dur': 100, 'max': 100},
{'ilvl': 1, 'dur': 103, 'max': 100},
{'ilvl': 7, 'dur': 43, 'max': 40}],
[]],
[0, 0, 0]),
('two stacked discounts #1', [[{'ilvl': 100, 'dur': 0, 'max': 120}], [10, 20]], [0, 22, 47]),
('nothing to repair #1', [[], [15]], [0, 0, 0]),
('control #1',
[[{'ilvl': 1, 'dur': 120, 'max': 120},
{'ilvl': 4, 'dur': 84, 'max': 100},
{'ilvl': 3, 'dur': 40, 'max': 40},
{'ilvl': 3, 'dur': 0, 'max': 120}],
[10, 33]],
[0, 0, 92])]]
for label, args, expected in cases[N-1]:
check(label, solve(*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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| over-repaired piece #1 | [0, 0, 60] | [0, 0, 60] | Passed |
| regression missing durability clamp #1 | [0, 0, 0] | [0, 0, 0] | Passed |
| regression missing durability clamp #2 | [0, 0, 0] | [0, 0, 0] | Passed |
| regression missing durability clamp #3 | [0, 0, 0] | [0, 0, 0] | Passed |
| regression missing durability clamp #4 | [0, 5, 96] | [0, 5, 96] | Passed |
| two stacked discounts #1 | [0, 22, 47] | [0, 22, 47] | Passed |
| nothing to repair #1 | [0, 0, 0] | [0, 0, 0] | Passed |
| control #1 | [0, 0, 0] | [0, 0, 0] | Passed |
SHA-256 / 6a5fb0411184a17750250ef191cb9d1537e23974af6ff698a5683975e17cad0f
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:50:45.546746+00:00.
Case digest / a34158cde6111b0e1fc6106318c8a9f035b360ff555727a386c02fd5c9dd7e06