FAILURE MAP
← Case archive

FA-86271 / Game economy crafting balance / Open access

Daily market rebalance: Rebalanced price ignores the ceiling · case 01

Popular items climb past the configured ceiling.

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

ROOT CAUSE

The final clamp only applies the floor.

THE FAILURE

The final clamp only applies the floor.

Unsuccessful approach: Clamping only to the ceiling lets crashes pass below the floor.

Case contract

If target <= 0 the price is only clamped to [floor, ceiling]. If sold > target: pct = min(20, floor((sold-target)*100/target)), step = floor(price*pct/100) but at least 1 when pct > 0, new = price + step. If sold < target: pct = min(15, floor((target-sold)*100/target)), new = price - floor(price*pct/100). Otherwise unchanged. Result clamped to [floor, ceiling].

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(price, sold, target, floor, ceiling):
    if target <= 0:
        return min(max(price, floor), ceiling)
    if sold > target:
        pct = min(20, (sold - target) * 100 // target)
        step = price * pct // 100
        if pct > 0:
            step = max(step, 1)
        new = price + step
    elif sold < target:
        pct = min(15, (target - sold) * 100 // target)
        new = price - price * pct // 100
    else:
        new = price
    return max(new, floor)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('fault site band clamp #1', [736, 68, 66, 28, 100], 100),
  ('fault site band clamp #2', [1833, 42, 40, 20, 549], 549),
  ('partial repair boundary #1', [9, 0, 1, 47, 499], 47),
  ('partial repair boundary #2', [3, 75, 76, 12, 1170], 12),
  ('no target listed #1', [5, 3, 0, 10, 50], 10),
  ('cheap item rises one #1', [3, 13, 10, 1, 100], 4),
  ('crash capped at 15 #1', [1000, 0, 40, 1, 5000], 850),
  ('control #1', [99, 1188, 396, 6, 782], 118)],
 [('fault site band clamp #1', [1449, 42, 40, 8, 680], 680),
  ('fault site band clamp #2', [508, 144, 365, 8, 95], 95),
  ('partial repair boundary #1', [3, 0, 10, 26, 481], 26),
  ('partial repair boundary #2', [1, 0, 40, 29, 801], 29),
  ('crash capped at 15 #1', [1000, 0, 40, 1, 5000], 850),
  ('no target listed #1', [5, 3, 0, 10, 50], 10),
  ('control #1', [99, 1188, 396, 6, 782], 118),
  ('control #2', [1000, 0, 0, 7, 47], 47)],
 [('fault site band clamp #1', [50, 16, 1, 43, 49], 49),
  ('fault site band clamp #2', [1000, 30, 10, 17, 816], 816),
  ('partial repair boundary #1', [1, 672, 671, 16, 40], 16),
  ('partial repair boundary #2', [9, 581, 582, 29, 801], 29),
  ('cheap item rises one #1', [3, 13, 10, 1, 100], 4),
  ('crash capped at 15 #1', [1000, 0, 40, 1, 5000], 850),
  ('control #1', [1000, 0, 0, 7, 47], 47),
  ('control #2', [1000, 5, 5, 37, 1007], 1000)],
 [('fault site band clamp #1', [1369, 46, 45, 46, 340], 340),
  ('fault site band clamp #2', [1314, 55, 55, 10, 1281], 1281),
  ('partial repair boundary #1', [50, 0, 1, 48, 402], 48),
  ('partial repair boundary #2', [1, 85, 84, 28, 1011], 28),
  ('no target listed #1', [5, 3, 0, 10, 50], 10),
  ('cheap item rises one #1', [3, 13, 10, 1, 100], 4),
  ('control #1', [50, 11, 10, 38, 410], 55),
  ('control #2', [99, 5, 5, 44, 212], 99)],
 [('fault site band clamp #1', [1167, 2, 1, 43, 172], 172),
  ('fault site band clamp #2', [1000, 96, 95, 44, 489], 489),
  ('partial repair boundary #1', [3, 40, 40, 47, 590], 47),
  ('partial repair boundary #2', [9, 53, 53, 21, 719], 21),
  ('crash capped at 15 #1', [1000, 0, 40, 1, 5000], 850),
  ('no target listed #1', [5, 3, 0, 10, 50], 10),
  ('control #1', [99, -1, 0, 37, 260], 99),
  ('control #2', [50, 42, 70, 38, 107], 43)]]
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
fault site band clamp #1758100Failed
fault site band clamp #21924549Failed
partial repair boundary #14747Passed
partial repair boundary #21212Passed
no target listed #11010Passed
cheap item rises one #144Passed
crash capped at 15 #1850850Passed
control #1118118Passed

SHA-256 / e5fd280ef009877dce45bed48a1dd3adcec36cd38479ef6e560ec1c42b076c3a

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(price, sold, target, floor, ceiling):
    if target <= 0:
        return min(max(price, floor), ceiling)
    if sold > target:
        pct = min(20, (sold - target) * 100 // target)
        step = price * pct // 100
        if pct > 0:
            step = max(step, 1)
        new = price + step
    elif sold < target:
        pct = min(15, (target - sold) * 100 // target)
        new = price - price * pct // 100
    else:
        new = price
    return min(new, ceiling)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('fault site band clamp #1', [736, 68, 66, 28, 100], 100),
  ('fault site band clamp #2', [1833, 42, 40, 20, 549], 549),
  ('partial repair boundary #1', [9, 0, 1, 47, 499], 47),
  ('partial repair boundary #2', [3, 75, 76, 12, 1170], 12),
  ('no target listed #1', [5, 3, 0, 10, 50], 10),
  ('cheap item rises one #1', [3, 13, 10, 1, 100], 4),
  ('crash capped at 15 #1', [1000, 0, 40, 1, 5000], 850),
  ('control #1', [99, 1188, 396, 6, 782], 118)],
 [('fault site band clamp #1', [1449, 42, 40, 8, 680], 680),
  ('fault site band clamp #2', [508, 144, 365, 8, 95], 95),
  ('partial repair boundary #1', [3, 0, 10, 26, 481], 26),
  ('partial repair boundary #2', [1, 0, 40, 29, 801], 29),
  ('crash capped at 15 #1', [1000, 0, 40, 1, 5000], 850),
  ('no target listed #1', [5, 3, 0, 10, 50], 10),
  ('control #1', [99, 1188, 396, 6, 782], 118),
  ('control #2', [1000, 0, 0, 7, 47], 47)],
 [('fault site band clamp #1', [50, 16, 1, 43, 49], 49),
  ('fault site band clamp #2', [1000, 30, 10, 17, 816], 816),
  ('partial repair boundary #1', [1, 672, 671, 16, 40], 16),
  ('partial repair boundary #2', [9, 581, 582, 29, 801], 29),
  ('cheap item rises one #1', [3, 13, 10, 1, 100], 4),
  ('crash capped at 15 #1', [1000, 0, 40, 1, 5000], 850),
  ('control #1', [1000, 0, 0, 7, 47], 47),
  ('control #2', [1000, 5, 5, 37, 1007], 1000)],
 [('fault site band clamp #1', [1369, 46, 45, 46, 340], 340),
  ('fault site band clamp #2', [1314, 55, 55, 10, 1281], 1281),
  ('partial repair boundary #1', [50, 0, 1, 48, 402], 48),
  ('partial repair boundary #2', [1, 85, 84, 28, 1011], 28),
  ('no target listed #1', [5, 3, 0, 10, 50], 10),
  ('cheap item rises one #1', [3, 13, 10, 1, 100], 4),
  ('control #1', [50, 11, 10, 38, 410], 55),
  ('control #2', [99, 5, 5, 44, 212], 99)],
 [('fault site band clamp #1', [1167, 2, 1, 43, 172], 172),
  ('fault site band clamp #2', [1000, 96, 95, 44, 489], 489),
  ('partial repair boundary #1', [3, 40, 40, 47, 590], 47),
  ('partial repair boundary #2', [9, 53, 53, 21, 719], 21),
  ('crash capped at 15 #1', [1000, 0, 40, 1, 5000], 850),
  ('no target listed #1', [5, 3, 0, 10, 50], 10),
  ('control #1', [99, -1, 0, 37, 260], 99),
  ('control #2', [50, 42, 70, 38, 107], 43)]]
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
fault site band clamp #1100100Passed
fault site band clamp #2549549Passed
partial repair boundary #1847Failed
partial repair boundary #2312Failed
no target listed #11010Passed
cheap item rises one #144Passed
crash capped at 15 #1850850Passed
control #1118118Passed

SHA-256 / 8a84b75d78367eb013acc7a458e91c647223ae670502aa287e1ff0831fcb4a4a

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

Case digest / d8906adf13e8fdbc105f6f7ef9c49ceb2ba9ffd2d5bcab30ff56758f95701369