FA-86056 / Game economy crafting balance / Open access
Crafted quality tier: Score cap withholds a perfect craft · case 01
Perfect crafts report 99 and the displayed score never reaches 100.
ROOT CAUSE
The score cap is one below the stated maximum.
VERIFIED REPAIR
Restore `score = min(100, score)` at the score cap step.
Unsuccessful approach: Clamping the lower bound instead leaves scores above 100.
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(99, 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 = [[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1', [[[100, 0], [100, 1]], 24, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[84, 0], [100, 3]], 24, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3', [[[100, 2]], 142, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[85, 0], [100, 1]], 150, 50], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1', [[[84, 0], [100, 3]], 24, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[100, 2]], 142, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3', [[[85, 0], [100, 1]], 150, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[84, 3], [100, 2], [100, 3]], 100, 50], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1', [[[85, 0], [100, 1]], 150, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[84, 3], [100, 2], [100, 3]], 100, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3', [[[64, 0], [100, 3]], 24, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[100, 1]], 24, 50], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1', [[[64, 0], [100, 3]], 24, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[100, 1]], 24, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3',
[[[0, 0], [0, 0], [84, 1], [92, 3]], 150, 50],
{'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[100, 3], [53, 1]], 150, 4], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 1], [100, 3], [85, 1]], 26, 5], {'score': 86, 'tier': 'masterwork'})],
[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1',
[[[0, 0], [0, 0], [84, 1], [92, 3]], 150, 50],
{'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[100, 3], [53, 1]], 150, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3',
[[[100, 2], [65, 1], [100, 1], [0, 0]], 150, 4],
{'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[85, 0], [100, 1]], 24, 4], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 3], [85, 0]], 52, 0], {'score': 44, 'tier': 'superior'})]]
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 |
|---|---|---|---|
| masterwork crit #1 | {'score': 99, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Failed |
| regression score cap #1 | {'score': 99, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Failed |
| regression score cap #2 | {'score': 99, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Failed |
| regression score cap #3 | {'score': 99, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Failed |
| regression score cap #4 | {'score': 99, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Failed |
| heavy rare material #1 | {'score': 75, 'tier': 'superior'} | {'score': 75, 'tier': 'superior'} | Passed |
| score exactly fine cutoff #1 | {'score': 40, 'tier': 'fine'} | {'score': 40, 'tier': 'fine'} | Passed |
| control #1 | {'score': 40, 'tier': 'fine'} | {'score': 40, 'tier': 'fine'} | Passed |
SHA-256 / c6be8775265e36a30fe0e503a3a8ebabaa0468c5fef2ac9eff738ce093f118f6
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 = max(0, 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 = [[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1', [[[100, 0], [100, 1]], 24, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[84, 0], [100, 3]], 24, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3', [[[100, 2]], 142, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[85, 0], [100, 1]], 150, 50], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1', [[[84, 0], [100, 3]], 24, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[100, 2]], 142, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3', [[[85, 0], [100, 1]], 150, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[84, 3], [100, 2], [100, 3]], 100, 50], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1', [[[85, 0], [100, 1]], 150, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[84, 3], [100, 2], [100, 3]], 100, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3', [[[64, 0], [100, 3]], 24, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[100, 1]], 24, 50], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1', [[[64, 0], [100, 3]], 24, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[100, 1]], 24, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3',
[[[0, 0], [0, 0], [84, 1], [92, 3]], 150, 50],
{'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[100, 3], [53, 1]], 150, 4], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 1], [100, 3], [85, 1]], 26, 5], {'score': 86, 'tier': 'masterwork'})],
[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1',
[[[0, 0], [0, 0], [84, 1], [92, 3]], 150, 50],
{'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[100, 3], [53, 1]], 150, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3',
[[[100, 2], [65, 1], [100, 1], [0, 0]], 150, 4],
{'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[85, 0], [100, 1]], 24, 4], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 3], [85, 0]], 52, 0], {'score': 44, 'tier': 'superior'})]]
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 |
|---|---|---|---|
| masterwork crit #1 | {'score': 105, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Failed |
| regression score cap #1 | {'score': 102, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Failed |
| regression score cap #2 | {'score': 102, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Failed |
| regression score cap #3 | {'score': 114, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Failed |
| regression score cap #4 | {'score': 115, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Failed |
| heavy rare material #1 | {'score': 75, 'tier': 'superior'} | {'score': 75, 'tier': 'superior'} | Passed |
| score exactly fine cutoff #1 | {'score': 40, 'tier': 'fine'} | {'score': 40, 'tier': 'fine'} | Passed |
| control #1 | {'score': 40, 'tier': 'fine'} | {'score': 40, 'tier': 'fine'} | Passed |
SHA-256 / 8476ff46b528ff9eb6997c58565530d4cfb63719ec9fa1e54a8076b9d8b0c50a
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 = [[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1', [[[100, 0], [100, 1]], 24, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[84, 0], [100, 3]], 24, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3', [[[100, 2]], 142, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[85, 0], [100, 1]], 150, 50], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1', [[[84, 0], [100, 3]], 24, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[100, 2]], 142, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3', [[[85, 0], [100, 1]], 150, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[84, 3], [100, 2], [100, 3]], 100, 50], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1', [[[85, 0], [100, 1]], 150, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[84, 3], [100, 2], [100, 3]], 100, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3', [[[64, 0], [100, 3]], 24, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[100, 1]], 24, 50], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1', [[[64, 0], [100, 3]], 24, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[100, 1]], 24, 50], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3',
[[[0, 0], [0, 0], [84, 1], [92, 3]], 150, 50],
{'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[100, 3], [53, 1]], 150, 4], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 1], [100, 3], [85, 1]], 26, 5], {'score': 86, 'tier': 'masterwork'})],
[('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #1',
[[[0, 0], [0, 0], [84, 1], [92, 3]], 150, 50],
{'score': 100, 'tier': 'masterwork'}),
('regression score cap #2', [[[100, 3], [53, 1]], 150, 4], {'score': 100, 'tier': 'masterwork'}),
('regression score cap #3',
[[[100, 2], [65, 1], [100, 1], [0, 0]], 150, 4],
{'score': 100, 'tier': 'masterwork'}),
('regression score cap #4', [[[85, 0], [100, 1]], 24, 4], {'score': 100, 'tier': 'masterwork'}),
('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
('control #1', [[[39, 3], [85, 0]], 52, 0], {'score': 44, 'tier': 'superior'})]]
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 |
|---|---|---|---|
| masterwork crit #1 | {'score': 100, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Passed |
| regression score cap #1 | {'score': 100, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Passed |
| regression score cap #2 | {'score': 100, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Passed |
| regression score cap #3 | {'score': 100, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Passed |
| regression score cap #4 | {'score': 100, 'tier': 'masterwork'} | {'score': 100, 'tier': 'masterwork'} | Passed |
| heavy rare material #1 | {'score': 75, 'tier': 'superior'} | {'score': 75, 'tier': 'superior'} | Passed |
| score exactly fine cutoff #1 | {'score': 40, 'tier': 'fine'} | {'score': 40, 'tier': 'fine'} | Passed |
| control #1 | {'score': 40, 'tier': 'fine'} | {'score': 40, 'tier': 'fine'} | Passed |
SHA-256 / 77b5216798090ef15d388cac26b545413b01bfd8dc2258ee82babc3b5f615e41
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.089956+00:00.
Case digest / 3ead6a2a424235f9420203aabf9ef17d2144816d3366885d6cd88f6413c00091