FA-85966 / Game economy crafting balance / Open access
Vendor sell saturation: Reputation bonus adds flat coins · case 01
Cheap items gain a huge relative reputation bonus.
ROOT CAUSE
The reputation percentage is added as a flat coin amount.
VERIFIED REPAIR
Restore `unit = unit * (100 + bonus) // 100` at the reputation bonus form step.
Unsuccessful approach: Applying the bonus to the base price discards the saturation discount.
Case contract
Selling qty units after `sales` units already sold today. Daily cap 20 units total; excess is returned. Per unit, with done = units sold today before it: saturation = min(60, 5*done) percent; unit = floor(base*(100-sat)/100), then floor(unit*(100+bonus)/100) with bonus neutral 0, friendly 5, honored 10; each unit pays at least 1.
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
N = 1
observations = []
def solve(base_price, sales, qty, reputation):
bonus = {'neutral': 0, 'friendly': 5, 'honored': 10}[reputation]
gold = 0
sold = 0
for i in range(qty):
done = sales + sold
if done >= 20:
break
sat = min(60, 5 * done)
unit = base_price * (100 - sat) // 100
unit = unit + bonus
gold += max(1, unit)
sold += 1
return {'gold': gold, 'sold': sold, 'returned': qty - sold}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),
('regression reputation bonus form #1', [10, 0, 7, 'friendly'], {'gold': 58, 'sold': 7, 'returned': 0}),
('partial repair boundary #1', [99, 5, 3, 'neutral'], {'gold': 207, 'sold': 3, 'returned': 0}),
('partial repair boundary #2', [3, 1, 11, 'neutral'], {'gold': 17, 'sold': 11, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [2, 22, 2, 'friendly'], {'gold': 0, 'sold': 0, 'returned': 2}),
('control #2', [3, 20, 3, 'honored'], {'gold': 0, 'sold': 0, 'returned': 3})],
[('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),
('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('regression reputation bonus form #1', [10, 0, 7, 'friendly'], {'gold': 58, 'sold': 7, 'returned': 0}),
('regression reputation bonus form #2', [10, 5, 10, 'friendly'], {'gold': 52, 'sold': 10, 'returned': 0}),
('partial repair boundary #1', [3, 1, 11, 'neutral'], {'gold': 17, 'sold': 11, 'returned': 0}),
('partial repair boundary #2', [190, 12, 7, 'neutral'], {'gold': 532, 'sold': 7, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [2, 22, 2, 'friendly'], {'gold': 0, 'sold': 0, 'returned': 2})],
[('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('regression reputation bonus form #1', [3, 12, 4, 'honored'], {'gold': 4, 'sold': 4, 'returned': 0}),
('regression reputation bonus form #2', [10, 1, 9, 'friendly'], {'gold': 65, 'sold': 9, 'returned': 0}),
('partial repair boundary #1', [190, 12, 7, 'neutral'], {'gold': 532, 'sold': 7, 'returned': 0}),
('regression reputation bonus form #3', [10, 5, 10, 'friendly'], {'gold': 52, 'sold': 10, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [10, 22, 10, 'neutral'], {'gold': 0, 'sold': 0, 'returned': 10}),
('control #2', [99, 20, 9, 'honored'], {'gold': 0, 'sold': 0, 'returned': 9})],
[('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),
('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('regression reputation bonus form #1', [7, 11, 1, 'honored'], {'gold': 3, 'sold': 1, 'returned': 0}),
('regression reputation bonus form #2', [15, 15, 7, 'friendly'], {'gold': 30, 'sold': 5, 'returned': 2}),
('partial repair boundary #1', [2, 15, 10, 'neutral'], {'gold': 5, 'sold': 5, 'returned': 5}),
('partial repair boundary #2', [25, 1, 4, 'neutral'], {'gold': 86, 'sold': 4, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [3, 22, 4, 'honored'], {'gold': 0, 'sold': 0, 'returned': 4})],
[('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('regression reputation bonus form #1', [2, 1, 5, 'honored'], {'gold': 5, 'sold': 5, 'returned': 0}),
('regression reputation bonus form #2', [99, 12, 4, 'friendly'], {'gold': 160, 'sold': 4, 'returned': 0}),
('regression reputation bonus form #3', [3, 12, 4, 'honored'], {'gold': 4, 'sold': 4, 'returned': 0}),
('regression reputation bonus form #4', [10, 1, 9, 'friendly'], {'gold': 65, 'sold': 9, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [7, 22, 10, 'honored'], {'gold': 0, 'sold': 0, 'returned': 10}),
('control #2', [55, 5, 0, 'neutral'], {'gold': 0, 'sold': 0, 'returned': 0})]]
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 |
|---|---|---|---|
| cap reached mid batch #1 | {'gold': 52, 'returned': 3, 'sold': 2} | {'gold': 34, 'returned': 3, 'sold': 2} | Failed |
| fresh day single sale #1 | {'gold': 14, 'returned': 0, 'sold': 1} | {'gold': 9, 'returned': 0, 'sold': 1} | Failed |
| regression reputation bonus form #1 | {'gold': 93, 'returned': 0, 'sold': 7} | {'gold': 58, 'returned': 0, 'sold': 7} | Failed |
| partial repair boundary #1 | {'gold': 207, 'returned': 0, 'sold': 3} | {'gold': 207, 'returned': 0, 'sold': 3} | Passed |
| partial repair boundary #2 | {'gold': 17, 'returned': 0, 'sold': 11} | {'gold': 17, 'returned': 0, 'sold': 11} | Passed |
| cheap junk at saturation #1 | {'gold': 3, 'returned': 0, 'sold': 3} | {'gold': 3, 'returned': 0, 'sold': 3} | Passed |
| control #1 | {'gold': 0, 'returned': 2, 'sold': 0} | {'gold': 0, 'returned': 2, 'sold': 0} | Passed |
| control #2 | {'gold': 0, 'returned': 3, 'sold': 0} | {'gold': 0, 'returned': 3, 'sold': 0} | Passed |
SHA-256 / 655c9e90ad0bde9da156f8a3594fb5869e66b5c7f7b52bc3871d037d887d1fad
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(base_price, sales, qty, reputation):
bonus = {'neutral': 0, 'friendly': 5, 'honored': 10}[reputation]
gold = 0
sold = 0
for i in range(qty):
done = sales + sold
if done >= 20:
break
sat = min(60, 5 * done)
unit = base_price * (100 - sat) // 100
unit = base_price * (100 + bonus) // 100
gold += max(1, unit)
sold += 1
return {'gold': gold, 'sold': sold, 'returned': qty - sold}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),
('regression reputation bonus form #1', [10, 0, 7, 'friendly'], {'gold': 58, 'sold': 7, 'returned': 0}),
('partial repair boundary #1', [99, 5, 3, 'neutral'], {'gold': 207, 'sold': 3, 'returned': 0}),
('partial repair boundary #2', [3, 1, 11, 'neutral'], {'gold': 17, 'sold': 11, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [2, 22, 2, 'friendly'], {'gold': 0, 'sold': 0, 'returned': 2}),
('control #2', [3, 20, 3, 'honored'], {'gold': 0, 'sold': 0, 'returned': 3})],
[('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),
('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('regression reputation bonus form #1', [10, 0, 7, 'friendly'], {'gold': 58, 'sold': 7, 'returned': 0}),
('regression reputation bonus form #2', [10, 5, 10, 'friendly'], {'gold': 52, 'sold': 10, 'returned': 0}),
('partial repair boundary #1', [3, 1, 11, 'neutral'], {'gold': 17, 'sold': 11, 'returned': 0}),
('partial repair boundary #2', [190, 12, 7, 'neutral'], {'gold': 532, 'sold': 7, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [2, 22, 2, 'friendly'], {'gold': 0, 'sold': 0, 'returned': 2})],
[('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('regression reputation bonus form #1', [3, 12, 4, 'honored'], {'gold': 4, 'sold': 4, 'returned': 0}),
('regression reputation bonus form #2', [10, 1, 9, 'friendly'], {'gold': 65, 'sold': 9, 'returned': 0}),
('partial repair boundary #1', [190, 12, 7, 'neutral'], {'gold': 532, 'sold': 7, 'returned': 0}),
('regression reputation bonus form #3', [10, 5, 10, 'friendly'], {'gold': 52, 'sold': 10, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [10, 22, 10, 'neutral'], {'gold': 0, 'sold': 0, 'returned': 10}),
('control #2', [99, 20, 9, 'honored'], {'gold': 0, 'sold': 0, 'returned': 9})],
[('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),
('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('regression reputation bonus form #1', [7, 11, 1, 'honored'], {'gold': 3, 'sold': 1, 'returned': 0}),
('regression reputation bonus form #2', [15, 15, 7, 'friendly'], {'gold': 30, 'sold': 5, 'returned': 2}),
('partial repair boundary #1', [2, 15, 10, 'neutral'], {'gold': 5, 'sold': 5, 'returned': 5}),
('partial repair boundary #2', [25, 1, 4, 'neutral'], {'gold': 86, 'sold': 4, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [3, 22, 4, 'honored'], {'gold': 0, 'sold': 0, 'returned': 4})],
[('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('regression reputation bonus form #1', [2, 1, 5, 'honored'], {'gold': 5, 'sold': 5, 'returned': 0}),
('regression reputation bonus form #2', [99, 12, 4, 'friendly'], {'gold': 160, 'sold': 4, 'returned': 0}),
('regression reputation bonus form #3', [3, 12, 4, 'honored'], {'gold': 4, 'sold': 4, 'returned': 0}),
('regression reputation bonus form #4', [10, 1, 9, 'friendly'], {'gold': 65, 'sold': 9, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [7, 22, 10, 'honored'], {'gold': 0, 'sold': 0, 'returned': 10}),
('control #2', [55, 5, 0, 'neutral'], {'gold': 0, 'sold': 0, 'returned': 0})]]
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 |
|---|---|---|---|
| cap reached mid batch #1 | {'gold': 88, 'returned': 3, 'sold': 2} | {'gold': 34, 'returned': 3, 'sold': 2} | Failed |
| fresh day single sale #1 | {'gold': 9, 'returned': 0, 'sold': 1} | {'gold': 9, 'returned': 0, 'sold': 1} | Passed |
| regression reputation bonus form #1 | {'gold': 70, 'returned': 0, 'sold': 7} | {'gold': 58, 'returned': 0, 'sold': 7} | Failed |
| partial repair boundary #1 | {'gold': 297, 'returned': 0, 'sold': 3} | {'gold': 207, 'returned': 0, 'sold': 3} | Failed |
| partial repair boundary #2 | {'gold': 33, 'returned': 0, 'sold': 11} | {'gold': 17, 'returned': 0, 'sold': 11} | Failed |
| cheap junk at saturation #1 | {'gold': 3, 'returned': 0, 'sold': 3} | {'gold': 3, 'returned': 0, 'sold': 3} | Passed |
| control #1 | {'gold': 0, 'returned': 2, 'sold': 0} | {'gold': 0, 'returned': 2, 'sold': 0} | Passed |
| control #2 | {'gold': 0, 'returned': 3, 'sold': 0} | {'gold': 0, 'returned': 3, 'sold': 0} | Passed |
SHA-256 / 031e8556ed008489d5cc4491c2753f96421a3c42ca55ff68ed8a561bea512bd4
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(base_price, sales, qty, reputation):
bonus = {'neutral': 0, 'friendly': 5, 'honored': 10}[reputation]
gold = 0
sold = 0
for i in range(qty):
done = sales + sold
if done >= 20:
break
sat = min(60, 5 * done)
unit = base_price * (100 - sat) // 100
unit = unit * (100 + bonus) // 100
gold += max(1, unit)
sold += 1
return {'gold': gold, 'sold': sold, 'returned': qty - sold}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),
('regression reputation bonus form #1', [10, 0, 7, 'friendly'], {'gold': 58, 'sold': 7, 'returned': 0}),
('partial repair boundary #1', [99, 5, 3, 'neutral'], {'gold': 207, 'sold': 3, 'returned': 0}),
('partial repair boundary #2', [3, 1, 11, 'neutral'], {'gold': 17, 'sold': 11, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [2, 22, 2, 'friendly'], {'gold': 0, 'sold': 0, 'returned': 2}),
('control #2', [3, 20, 3, 'honored'], {'gold': 0, 'sold': 0, 'returned': 3})],
[('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),
('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('regression reputation bonus form #1', [10, 0, 7, 'friendly'], {'gold': 58, 'sold': 7, 'returned': 0}),
('regression reputation bonus form #2', [10, 5, 10, 'friendly'], {'gold': 52, 'sold': 10, 'returned': 0}),
('partial repair boundary #1', [3, 1, 11, 'neutral'], {'gold': 17, 'sold': 11, 'returned': 0}),
('partial repair boundary #2', [190, 12, 7, 'neutral'], {'gold': 532, 'sold': 7, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [2, 22, 2, 'friendly'], {'gold': 0, 'sold': 0, 'returned': 2})],
[('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('regression reputation bonus form #1', [3, 12, 4, 'honored'], {'gold': 4, 'sold': 4, 'returned': 0}),
('regression reputation bonus form #2', [10, 1, 9, 'friendly'], {'gold': 65, 'sold': 9, 'returned': 0}),
('partial repair boundary #1', [190, 12, 7, 'neutral'], {'gold': 532, 'sold': 7, 'returned': 0}),
('regression reputation bonus form #3', [10, 5, 10, 'friendly'], {'gold': 52, 'sold': 10, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [10, 22, 10, 'neutral'], {'gold': 0, 'sold': 0, 'returned': 10}),
('control #2', [99, 20, 9, 'honored'], {'gold': 0, 'sold': 0, 'returned': 9})],
[('fresh day single sale #1', [9, 0, 1, 'friendly'], {'gold': 9, 'sold': 1, 'returned': 0}),
('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('regression reputation bonus form #1', [7, 11, 1, 'honored'], {'gold': 3, 'sold': 1, 'returned': 0}),
('regression reputation bonus form #2', [15, 15, 7, 'friendly'], {'gold': 30, 'sold': 5, 'returned': 2}),
('partial repair boundary #1', [2, 15, 10, 'neutral'], {'gold': 5, 'sold': 5, 'returned': 5}),
('partial repair boundary #2', [25, 1, 4, 'neutral'], {'gold': 86, 'sold': 4, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [3, 22, 4, 'honored'], {'gold': 0, 'sold': 0, 'returned': 4})],
[('cap reached mid batch #1', [40, 18, 5, 'honored'], {'gold': 34, 'sold': 2, 'returned': 3}),
('regression reputation bonus form #1', [2, 1, 5, 'honored'], {'gold': 5, 'sold': 5, 'returned': 0}),
('regression reputation bonus form #2', [99, 12, 4, 'friendly'], {'gold': 160, 'sold': 4, 'returned': 0}),
('regression reputation bonus form #3', [3, 12, 4, 'honored'], {'gold': 4, 'sold': 4, 'returned': 0}),
('regression reputation bonus form #4', [10, 1, 9, 'friendly'], {'gold': 65, 'sold': 9, 'returned': 0}),
('cheap junk at saturation #1', [1, 12, 3, 'neutral'], {'gold': 3, 'sold': 3, 'returned': 0}),
('control #1', [7, 22, 10, 'honored'], {'gold': 0, 'sold': 0, 'returned': 10}),
('control #2', [55, 5, 0, 'neutral'], {'gold': 0, 'sold': 0, 'returned': 0})]]
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 |
|---|---|---|---|
| cap reached mid batch #1 | {'gold': 34, 'returned': 3, 'sold': 2} | {'gold': 34, 'returned': 3, 'sold': 2} | Passed |
| fresh day single sale #1 | {'gold': 9, 'returned': 0, 'sold': 1} | {'gold': 9, 'returned': 0, 'sold': 1} | Passed |
| regression reputation bonus form #1 | {'gold': 58, 'returned': 0, 'sold': 7} | {'gold': 58, 'returned': 0, 'sold': 7} | Passed |
| partial repair boundary #1 | {'gold': 207, 'returned': 0, 'sold': 3} | {'gold': 207, 'returned': 0, 'sold': 3} | Passed |
| partial repair boundary #2 | {'gold': 17, 'returned': 0, 'sold': 11} | {'gold': 17, 'returned': 0, 'sold': 11} | Passed |
| cheap junk at saturation #1 | {'gold': 3, 'returned': 0, 'sold': 3} | {'gold': 3, 'returned': 0, 'sold': 3} | Passed |
| control #1 | {'gold': 0, 'returned': 2, 'sold': 0} | {'gold': 0, 'returned': 2, 'sold': 0} | Passed |
| control #2 | {'gold': 0, 'returned': 3, 'sold': 0} | {'gold': 0, 'returned': 3, 'sold': 0} | Passed |
SHA-256 / b3aaa68013e77fa29fc4e2ba20af429768885c64c83a4b6db370c00a78a03912
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.165572+00:00.
Case digest / 3aad9e106619e843e12bf6450c1807decf28bbc8fe84754010641c1dd3bb5e0f