FA-86061 / Game economy crafting balance / Open access
Crafted quality tier: Cutoff score falls into the lower tier · case 01
A craft exactly on a tier cutoff is graded one tier lower.
ROOT CAUSE
Tier cutoffs are compared strictly.
VERIFIED REPAIR
Restore `score >= c` at the tier cutoff inclusion step.
Unsuccessful approach: Lowering each cutoff by one promotes scores one below the threshold.
Case contract
materials = [[quality, weight], ...]. If total weight <= 0 the craft fails (score 0, tier "failed"). score = floor(sum(q*w)/sum(w)) + skill//10, capped at 100. Tier index = number of cutoffs [40, 65, 85] with score >= cutoff over [common, fine, superior, masterwork]. A critical craft (skill >= 25 and crit_roll < 5) raises the tier by one, never above masterwork.
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(materials, skill, crit_roll):
tiers = ['common', 'fine', 'superior', 'masterwork']
cuts = [40, 65, 85]
total_w = sum(w for q, w in materials)
if total_w <= 0:
return {'score': 0, 'tier': 'failed'}
score = sum(q * w for q, w in materials) // total_w + skill // 10
score = min(100, score)
t = sum(1 for c in cuts if score > c)
if skill >= 25 and crit_roll < 5:
t = min(t + 1, len(tiers) - 1)
return {'score': score, 'tier': tiers[t]}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #2',
[[[40, 0], [65, 0], [84, 1], [100, 0]], 17, 4],
{'score': 85, 'tier': 'masterwork'}),
('partial repair boundary #1', [[[0, 0], [64, 3]], 0, 0], {'score': 64, 'tier': 'fine'}),
('partial repair boundary #2', [[[30, 1], [0, 1], [84, 1]], 10, 4], {'score': 39, 'tier': 'common'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 1], [100, 3], [85, 1]], 26, 5], {'score': 86, 'tier': 'masterwork'})],
[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1',
[[[40, 0], [65, 0], [84, 1], [100, 0]], 17, 4],
{'score': 85, 'tier': 'masterwork'}),
('fault site tier cutoff inclusion #2',
[[[0, 1], [65, 3], [0, 0], [64, 3]], 103, 10],
{'score': 65, 'tier': 'superior'}),
('partial repair boundary #1',
[[[40, 3], [100, 0], [0, 1], [65, 1]], 25, 50],
{'score': 39, 'tier': 'common'}),
('partial repair boundary #2', [[[39, 1]], 6, 19], {'score': 39, 'tier': 'common'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 1], [100, 3], [85, 1]], 26, 5], {'score': 86, 'tier': 'masterwork'})],
[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1', [[[64, 3], [65, 2]], 10, 5], {'score': 65, 'tier': 'superior'}),
('fault site tier cutoff inclusion #2', [[[64, 3]], 10, 5], {'score': 65, 'tier': 'superior'}),
('partial repair boundary #1',
[[[100, 1], [84, 3], [8, 0], [39, 1]], 64, 50],
{'score': 84, 'tier': 'superior'}),
('partial repair boundary #2', [[[100, 1], [65, 1]], 25, 5], {'score': 84, 'tier': 'superior'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 1], [100, 3], [85, 1]], 26, 5], {'score': 86, 'tier': 'masterwork'})],
[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1',
[[[0, 0], [100, 2], [39, 3]], 24, 5],
{'score': 65, 'tier': 'superior'}),
('fault site tier cutoff inclusion #2',
[[[86, 1], [85, 0], [64, 1], [64, 0]], 100, 5],
{'score': 85, 'tier': 'masterwork'}),
('partial repair boundary #1', [[[85, 0], [39, 2], [39, 3]], 0, 4], {'score': 39, 'tier': 'common'}),
('partial repair boundary #2', [[[64, 3]], 0, 50], {'score': 64, 'tier': 'fine'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 3], [85, 0]], 52, 0], {'score': 44, 'tier': 'superior'})],
[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1', [[[65, 1]], 0, 0], {'score': 65, 'tier': 'superior'}),
('fault site tier cutoff inclusion #2', [[[65, 3]], 0, 5], {'score': 65, 'tier': 'superior'}),
('partial repair boundary #1', [[[40, 3], [39, 2], [64, 0]], 0, 5], {'score': 39, 'tier': 'common'}),
('partial repair boundary #2',
[[[0, 0], [78, 1], [40, 2], [0, 1]], 9, 89],
{'score': 39, 'tier': 'common'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 1]], 25, 5], {'score': 41, 'tier': 'fine'})]]
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 |
|---|---|---|---|
| score exactly fine cutoff #1 | {'score': 40, 'tier': 'common'} | {'score': 40, 'tier': 'fine'} | Failed |
| fault site tier cutoff inclusion #1 | {'score': 40, 'tier': 'common'} | {'score': 40, 'tier': 'fine'} | Failed |
| fault site tier cutoff inclusion #2 | {'score': 85, 'tier': 'superior'} | {'score': 85, 'tier': 'masterwork'} | Failed |
| partial repair boundary #1 | {'score': 64, 'tier': 'fine'} | {'score': 64, 'tier': 'fine'} | Passed |
| partial repair boundary #2 | {'score': 39, 'tier': 'common'} | {'score': 39, 'tier': 'common'} | Passed |
| heavy rare material #1 | {'score': 75, 'tier': 'superior'} | {'score': 75, 'tier': 'superior'} | Passed |
| masterwork crit #1 | {'score': 100, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Passed |
| control #1 | {'score': 86, 'tier': 'masterwork'} | {'score': 86, 'tier': 'masterwork'} | Passed |
SHA-256 / 3e1395de732cb14975e7c150e9ee0cdd580354f830ff31a7882cef9257e3e9bf
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(materials, skill, crit_roll):
tiers = ['common', 'fine', 'superior', 'masterwork']
cuts = [40, 65, 85]
total_w = sum(w for q, w in materials)
if total_w <= 0:
return {'score': 0, 'tier': 'failed'}
score = sum(q * w for q, w in materials) // total_w + skill // 10
score = min(100, score)
t = sum(1 for c in cuts if score >= c - 1)
if skill >= 25 and crit_roll < 5:
t = min(t + 1, len(tiers) - 1)
return {'score': score, 'tier': tiers[t]}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #2',
[[[40, 0], [65, 0], [84, 1], [100, 0]], 17, 4],
{'score': 85, 'tier': 'masterwork'}),
('partial repair boundary #1', [[[0, 0], [64, 3]], 0, 0], {'score': 64, 'tier': 'fine'}),
('partial repair boundary #2', [[[30, 1], [0, 1], [84, 1]], 10, 4], {'score': 39, 'tier': 'common'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 1], [100, 3], [85, 1]], 26, 5], {'score': 86, 'tier': 'masterwork'})],
[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1',
[[[40, 0], [65, 0], [84, 1], [100, 0]], 17, 4],
{'score': 85, 'tier': 'masterwork'}),
('fault site tier cutoff inclusion #2',
[[[0, 1], [65, 3], [0, 0], [64, 3]], 103, 10],
{'score': 65, 'tier': 'superior'}),
('partial repair boundary #1',
[[[40, 3], [100, 0], [0, 1], [65, 1]], 25, 50],
{'score': 39, 'tier': 'common'}),
('partial repair boundary #2', [[[39, 1]], 6, 19], {'score': 39, 'tier': 'common'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 1], [100, 3], [85, 1]], 26, 5], {'score': 86, 'tier': 'masterwork'})],
[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1', [[[64, 3], [65, 2]], 10, 5], {'score': 65, 'tier': 'superior'}),
('fault site tier cutoff inclusion #2', [[[64, 3]], 10, 5], {'score': 65, 'tier': 'superior'}),
('partial repair boundary #1',
[[[100, 1], [84, 3], [8, 0], [39, 1]], 64, 50],
{'score': 84, 'tier': 'superior'}),
('partial repair boundary #2', [[[100, 1], [65, 1]], 25, 5], {'score': 84, 'tier': 'superior'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 1], [100, 3], [85, 1]], 26, 5], {'score': 86, 'tier': 'masterwork'})],
[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1',
[[[0, 0], [100, 2], [39, 3]], 24, 5],
{'score': 65, 'tier': 'superior'}),
('fault site tier cutoff inclusion #2',
[[[86, 1], [85, 0], [64, 1], [64, 0]], 100, 5],
{'score': 85, 'tier': 'masterwork'}),
('partial repair boundary #1', [[[85, 0], [39, 2], [39, 3]], 0, 4], {'score': 39, 'tier': 'common'}),
('partial repair boundary #2', [[[64, 3]], 0, 50], {'score': 64, 'tier': 'fine'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 3], [85, 0]], 52, 0], {'score': 44, 'tier': 'superior'})],
[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1', [[[65, 1]], 0, 0], {'score': 65, 'tier': 'superior'}),
('fault site tier cutoff inclusion #2', [[[65, 3]], 0, 5], {'score': 65, 'tier': 'superior'}),
('partial repair boundary #1', [[[40, 3], [39, 2], [64, 0]], 0, 5], {'score': 39, 'tier': 'common'}),
('partial repair boundary #2',
[[[0, 0], [78, 1], [40, 2], [0, 1]], 9, 89],
{'score': 39, 'tier': 'common'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 1]], 25, 5], {'score': 41, 'tier': 'fine'})]]
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 |
|---|---|---|---|
| score exactly fine cutoff #1 | {'score': 40, 'tier': 'fine'} | {'score': 40, 'tier': 'fine'} | Passed |
| fault site tier cutoff inclusion #1 | {'score': 40, 'tier': 'fine'} | {'score': 40, 'tier': 'fine'} | Passed |
| fault site tier cutoff inclusion #2 | {'score': 85, 'tier': 'masterwork'} | {'score': 85, 'tier': 'masterwork'} | Passed |
| partial repair boundary #1 | {'score': 64, 'tier': 'superior'} | {'score': 64, 'tier': 'fine'} | Failed |
| partial repair boundary #2 | {'score': 39, 'tier': 'fine'} | {'score': 39, 'tier': 'common'} | Failed |
| heavy rare material #1 | {'score': 75, 'tier': 'superior'} | {'score': 75, 'tier': 'superior'} | Passed |
| masterwork crit #1 | {'score': 100, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Passed |
| control #1 | {'score': 86, 'tier': 'masterwork'} | {'score': 86, 'tier': 'masterwork'} | Passed |
SHA-256 / a6ecaaa323ff01efae8f354c8e8612fb1626aaf8024e2b4f328f3bb757f77c44
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(materials, skill, crit_roll):
tiers = ['common', 'fine', 'superior', 'masterwork']
cuts = [40, 65, 85]
total_w = sum(w for q, w in materials)
if total_w <= 0:
return {'score': 0, 'tier': 'failed'}
score = sum(q * w for q, w in materials) // total_w + skill // 10
score = min(100, score)
t = sum(1 for c in cuts if score >= c)
if skill >= 25 and crit_roll < 5:
t = min(t + 1, len(tiers) - 1)
return {'score': score, 'tier': tiers[t]}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #2',
[[[40, 0], [65, 0], [84, 1], [100, 0]], 17, 4],
{'score': 85, 'tier': 'masterwork'}),
('partial repair boundary #1', [[[0, 0], [64, 3]], 0, 0], {'score': 64, 'tier': 'fine'}),
('partial repair boundary #2', [[[30, 1], [0, 1], [84, 1]], 10, 4], {'score': 39, 'tier': 'common'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 1], [100, 3], [85, 1]], 26, 5], {'score': 86, 'tier': 'masterwork'})],
[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1',
[[[40, 0], [65, 0], [84, 1], [100, 0]], 17, 4],
{'score': 85, 'tier': 'masterwork'}),
('fault site tier cutoff inclusion #2',
[[[0, 1], [65, 3], [0, 0], [64, 3]], 103, 10],
{'score': 65, 'tier': 'superior'}),
('partial repair boundary #1',
[[[40, 3], [100, 0], [0, 1], [65, 1]], 25, 50],
{'score': 39, 'tier': 'common'}),
('partial repair boundary #2', [[[39, 1]], 6, 19], {'score': 39, 'tier': 'common'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 1], [100, 3], [85, 1]], 26, 5], {'score': 86, 'tier': 'masterwork'})],
[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1', [[[64, 3], [65, 2]], 10, 5], {'score': 65, 'tier': 'superior'}),
('fault site tier cutoff inclusion #2', [[[64, 3]], 10, 5], {'score': 65, 'tier': 'superior'}),
('partial repair boundary #1',
[[[100, 1], [84, 3], [8, 0], [39, 1]], 64, 50],
{'score': 84, 'tier': 'superior'}),
('partial repair boundary #2', [[[100, 1], [65, 1]], 25, 5], {'score': 84, 'tier': 'superior'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 1], [100, 3], [85, 1]], 26, 5], {'score': 86, 'tier': 'masterwork'})],
[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1',
[[[0, 0], [100, 2], [39, 3]], 24, 5],
{'score': 65, 'tier': 'superior'}),
('fault site tier cutoff inclusion #2',
[[[86, 1], [85, 0], [64, 1], [64, 0]], 100, 5],
{'score': 85, 'tier': 'masterwork'}),
('partial repair boundary #1', [[[85, 0], [39, 2], [39, 3]], 0, 4], {'score': 39, 'tier': 'common'}),
('partial repair boundary #2', [[[64, 3]], 0, 50], {'score': 64, 'tier': 'fine'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 3], [85, 0]], 52, 0], {'score': 44, 'tier': 'superior'})],
[('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('fault site tier cutoff inclusion #1', [[[65, 1]], 0, 0], {'score': 65, 'tier': 'superior'}),
('fault site tier cutoff inclusion #2', [[[65, 3]], 0, 5], {'score': 65, 'tier': 'superior'}),
('partial repair boundary #1', [[[40, 3], [39, 2], [64, 0]], 0, 5], {'score': 39, 'tier': 'common'}),
('partial repair boundary #2',
[[[0, 0], [78, 1], [40, 2], [0, 1]], 9, 89],
{'score': 39, 'tier': 'common'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('control #1', [[[39, 1]], 25, 5], {'score': 41, 'tier': 'fine'})]]
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 |
|---|---|---|---|
| score exactly fine cutoff #1 | {'score': 40, 'tier': 'fine'} | {'score': 40, 'tier': 'fine'} | Passed |
| fault site tier cutoff inclusion #1 | {'score': 40, 'tier': 'fine'} | {'score': 40, 'tier': 'fine'} | Passed |
| fault site tier cutoff inclusion #2 | {'score': 85, 'tier': 'masterwork'} | {'score': 85, 'tier': 'masterwork'} | Passed |
| partial repair boundary #1 | {'score': 64, 'tier': 'fine'} | {'score': 64, 'tier': 'fine'} | Passed |
| partial repair boundary #2 | {'score': 39, 'tier': 'common'} | {'score': 39, 'tier': 'common'} | Passed |
| heavy rare material #1 | {'score': 75, 'tier': 'superior'} | {'score': 75, 'tier': 'superior'} | Passed |
| masterwork crit #1 | {'score': 100, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Passed |
| control #1 | {'score': 86, 'tier': 'masterwork'} | {'score': 86, 'tier': 'masterwork'} | Passed |
SHA-256 / 9b52a8f5ef5cf3e821d6b1c0b8aa18844733ecc34ce9d5461aaa8ca8ceda3a81
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:46.124450+00:00.
Case digest / 2d86c66b0315def2b31da5136935dc5626e201b8144d513363793303f975805f