FAILURE MAP
← Case archive

FA-86051 / Game economy crafting balance / Open access

Crafted quality tier: Material weights are ignored · case 01

A small pinch of a rare reagent counts as much as the bulk material.

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

ROOT CAUSE

Quality is a plain mean of material qualities instead of the weighted mean.

THE FAILURE

Quality is a plain mean of material qualities instead of the weighted mean.

Unsuccessful approach: Dividing the weighted sum by the material count inflates scores whenever weights exceed one.

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 for q, w in materials) // len(materials) + 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 = [[('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
  ('regression material weighting #1',
   [[[39, 1], [100, 3], [85, 1]], 26, 5],
   {'score': 86, 'tier': 'masterwork'}),
  ('regression material weighting #2', [[[39, 3], [85, 0]], 52, 0], {'score': 44, 'tier': 'superior'}),
  ('regression material weighting #3',
   [[[100, 1], [65, 3], [40, 1], [39, 1]], 99, 4],
   {'score': 71, 'tier': 'masterwork'}),
  ('regression material weighting #4', [[[58, 0], [40, 0], [58, 1]], 9, 0], {'score': 58, 'tier': 'fine'}),
  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
  ('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
 [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
  ('regression material weighting #1', [[[39, 3], [85, 0]], 52, 0], {'score': 44, 'tier': 'superior'}),
  ('regression material weighting #2',
   [[[100, 1], [65, 3], [40, 1], [39, 1]], 99, 4],
   {'score': 71, 'tier': 'masterwork'}),
  ('regression material weighting #3', [[[58, 0], [40, 0], [58, 1]], 9, 0], {'score': 58, 'tier': 'fine'}),
  ('regression material weighting #4', [[[0, 0], [64, 3]], 0, 0], {'score': 64, 'tier': 'fine'}),
  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
  ('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
 [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
  ('regression material weighting #1', [[[58, 0], [40, 0], [58, 1]], 9, 0], {'score': 58, 'tier': 'fine'}),
  ('regression material weighting #2', [[[0, 0], [64, 3]], 0, 0], {'score': 64, 'tier': 'fine'}),
  ('regression material weighting #3',
   [[[65, 1], [65, 0], [39, 1], [64, 1]], 25, 16],
   {'score': 58, 'tier': 'fine'}),
  ('regression material weighting #4', [[[39, 2], [0, 1], [65, 2]], 25, 5], {'score': 43, 'tier': 'fine'}),
  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
  ('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
 [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
  ('regression material weighting #1',
   [[[65, 1], [65, 0], [39, 1], [64, 1]], 25, 16],
   {'score': 58, 'tier': 'fine'}),
  ('regression material weighting #2', [[[39, 2], [0, 1], [65, 2]], 25, 5], {'score': 43, 'tier': 'fine'}),
  ('regression material weighting #3',
   [[[40, 0], [65, 0], [84, 1], [100, 0]], 17, 4],
   {'score': 85, 'tier': 'masterwork'}),
  ('regression material weighting #4',
   [[[0, 1], [65, 3], [0, 0], [64, 3]], 103, 10],
   {'score': 65, 'tier': 'superior'}),
  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
  ('control #1', [[[39, 1]], 25, 5], {'score': 41, 'tier': 'fine'})],
 [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
  ('regression material weighting #1',
   [[[40, 0], [65, 0], [84, 1], [100, 0]], 17, 4],
   {'score': 85, 'tier': 'masterwork'}),
  ('regression material weighting #2',
   [[[0, 1], [65, 3], [0, 0], [64, 3]], 103, 10],
   {'score': 65, 'tier': 'superior'}),
  ('regression material weighting #3', [[[100, 0], [40, 3]], 150, 50], {'score': 55, 'tier': 'fine'}),
  ('partial repair boundary #1', [[[100, 0], [100, 1]], 24, 50], {'score': 100, 'tier': 'masterwork'}),
  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
  ('control #1', [[[39, 0]], 24, 28], {'score': 0, 'tier': 'failed'})]]
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 fixtureActualExpectedOutcome
heavy rare material #1{'score': 60, 'tier': 'fine'}{'score': 75, 'tier': 'superior'}Failed
regression material weighting #1{'score': 76, 'tier': 'superior'}{'score': 86, 'tier': 'masterwork'}Failed
regression material weighting #2{'score': 67, 'tier': 'masterwork'}{'score': 44, 'tier': 'superior'}Failed
regression material weighting #3{'score': 70, 'tier': 'masterwork'}{'score': 71, 'tier': 'masterwork'}Failed
regression material weighting #4{'score': 52, 'tier': 'fine'}{'score': 58, 'tier': 'fine'}Failed
score exactly fine cutoff #1{'score': 40, 'tier': 'fine'}{'score': 40, 'tier': 'fine'}Passed
masterwork crit #1{'score': 100, 'tier': 'masterwork'}{'score': 100, 'tier': 'masterwork'}Passed
control #1{'score': 40, 'tier': 'fine'}{'score': 40, 'tier': 'fine'}Passed

SHA-256 / b7cb7db4a4a83b6223b6c195c21548221aecd89a3924a70df3fc166ecd6ad65e

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) // len(materials) + 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 = [[('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
  ('regression material weighting #1',
   [[[39, 1], [100, 3], [85, 1]], 26, 5],
   {'score': 86, 'tier': 'masterwork'}),
  ('regression material weighting #2', [[[39, 3], [85, 0]], 52, 0], {'score': 44, 'tier': 'superior'}),
  ('regression material weighting #3',
   [[[100, 1], [65, 3], [40, 1], [39, 1]], 99, 4],
   {'score': 71, 'tier': 'masterwork'}),
  ('regression material weighting #4', [[[58, 0], [40, 0], [58, 1]], 9, 0], {'score': 58, 'tier': 'fine'}),
  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
  ('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
 [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
  ('regression material weighting #1', [[[39, 3], [85, 0]], 52, 0], {'score': 44, 'tier': 'superior'}),
  ('regression material weighting #2',
   [[[100, 1], [65, 3], [40, 1], [39, 1]], 99, 4],
   {'score': 71, 'tier': 'masterwork'}),
  ('regression material weighting #3', [[[58, 0], [40, 0], [58, 1]], 9, 0], {'score': 58, 'tier': 'fine'}),
  ('regression material weighting #4', [[[0, 0], [64, 3]], 0, 0], {'score': 64, 'tier': 'fine'}),
  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
  ('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
 [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
  ('regression material weighting #1', [[[58, 0], [40, 0], [58, 1]], 9, 0], {'score': 58, 'tier': 'fine'}),
  ('regression material weighting #2', [[[0, 0], [64, 3]], 0, 0], {'score': 64, 'tier': 'fine'}),
  ('regression material weighting #3',
   [[[65, 1], [65, 0], [39, 1], [64, 1]], 25, 16],
   {'score': 58, 'tier': 'fine'}),
  ('regression material weighting #4', [[[39, 2], [0, 1], [65, 2]], 25, 5], {'score': 43, 'tier': 'fine'}),
  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
  ('control #1', [[[39, 1]], 10, 50], {'score': 40, 'tier': 'fine'})],
 [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
  ('regression material weighting #1',
   [[[65, 1], [65, 0], [39, 1], [64, 1]], 25, 16],
   {'score': 58, 'tier': 'fine'}),
  ('regression material weighting #2', [[[39, 2], [0, 1], [65, 2]], 25, 5], {'score': 43, 'tier': 'fine'}),
  ('regression material weighting #3',
   [[[40, 0], [65, 0], [84, 1], [100, 0]], 17, 4],
   {'score': 85, 'tier': 'masterwork'}),
  ('regression material weighting #4',
   [[[0, 1], [65, 3], [0, 0], [64, 3]], 103, 10],
   {'score': 65, 'tier': 'superior'}),
  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
  ('control #1', [[[39, 1]], 25, 5], {'score': 41, 'tier': 'fine'})],
 [('heavy rare material #1', [[[90, 3], [30, 1]], 0, 50], {'score': 75, 'tier': 'superior'}),
  ('regression material weighting #1',
   [[[40, 0], [65, 0], [84, 1], [100, 0]], 17, 4],
   {'score': 85, 'tier': 'masterwork'}),
  ('regression material weighting #2',
   [[[0, 1], [65, 3], [0, 0], [64, 3]], 103, 10],
   {'score': 65, 'tier': 'superior'}),
  ('regression material weighting #3', [[[100, 0], [40, 3]], 150, 50], {'score': 55, 'tier': 'fine'}),
  ('partial repair boundary #1', [[[100, 0], [100, 1]], 24, 50], {'score': 100, 'tier': 'masterwork'}),
  ('score exactly fine cutoff #1', [[[40, 1]], 0, 99], {'score': 40, 'tier': 'fine'}),
  ('masterwork crit #1', [[[100, 2]], 50, 0], {'score': 100, 'tier': 'masterwork'}),
  ('control #1', [[[39, 0]], 24, 28], {'score': 0, 'tier': 'failed'})]]
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 fixtureActualExpectedOutcome
heavy rare material #1{'score': 100, 'tier': 'masterwork'}{'score': 75, 'tier': 'superior'}Failed
regression material weighting #1{'score': 100, 'tier': 'masterwork'}{'score': 86, 'tier': 'masterwork'}Failed
regression material weighting #2{'score': 63, 'tier': 'superior'}{'score': 44, 'tier': 'superior'}Failed
regression material weighting #3{'score': 100, 'tier': 'masterwork'}{'score': 71, 'tier': 'masterwork'}Failed
regression material weighting #4{'score': 19, 'tier': 'common'}{'score': 58, 'tier': 'fine'}Failed
score exactly fine cutoff #1{'score': 40, 'tier': 'fine'}{'score': 40, 'tier': 'fine'}Passed
masterwork crit #1{'score': 100, 'tier': 'masterwork'}{'score': 100, 'tier': 'masterwork'}Passed
control #1{'score': 40, 'tier': 'fine'}{'score': 40, 'tier': 'fine'}Passed

SHA-256 / 28e20d33060d82534b96dad1893d0900770ce08f5155b8e6013b223e81e1bf8d

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 9ff8098eca2fda0b8ed3b3f8bf4ee63ea0e9683afde81ee363f9e50ea2eee1bf