FAILURE MAP
← Case archive

FA-86191 / Game economy crafting balance / Open access

Gem combining cascade: Combining runs top-down · case 01

Freshly made gems do not cascade to the next tier.

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

ROOT CAUSE

Tiers are processed from the top, so new gems miss their cascade.

THE FAILURE

Tiers are processed from the top, so new gems miss their cascade.

Unsuccessful approach: Stopping one tier early skips the combine into the max tier.

Case contract

gems[t] = count of tier t gems for t = 0..max_tier. Tiers are processed upward: three tier t gems make one tier t+1 gem at a cost of (t+1)*10 gold each, limited by the remaining gold budget; newly made gems can cascade into the next tier. Max-tier gems never combine. Returns [counts, gold_spent].

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(gems, max_tier, budget):
    g = list(gems)
    gold = 0
    for t in reversed(range(max_tier)):
        price = (t + 1) * 10
        made = min(g[t] // 3, (budget - gold) // price)
        g[t] -= made * 3
        g[t + 1] += made
        gold += made * price
    return [g, gold]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('two level cascade #1', [[9, 0, 0], 2, 1000], [[0, 0, 1], 50]),
  ('regression cascade direction #1', [[9, 3, 2], 2, 1000], [[0, 0, 4], 70]),
  ('fault site cascade direction #1', [[4, 4, 3, 3, 9], 4, 29], [[1, 5, 3, 3, 9], 10]),
  ('regression cascade direction #2', [[4, 2, 0, 3, 6], 4, 201], [[1, 0, 1, 0, 7], 70]),
  ('partial repair boundary #1', [[4, 22], 1, 30], [[1, 23], 10]),
  ('budget stops second tier #1', [[9, 1, 0], 2, 30], [[0, 4, 0], 30]),
  ('max tier untouched #1', [[0, 6], 1, 1000], [[0, 6], 0]),
  ('control #1', [[27, 2, 2], 2, 60], [[9, 8, 2], 60])],
 [('two level cascade #1', [[9, 0, 0], 2, 1000], [[0, 0, 1], 50]),
  ('fault site cascade direction #1', [[4, 4, 3, 3, 9], 4, 29], [[1, 5, 3, 3, 9], 10]),
  ('fault site cascade direction #2', [[3, 9, 8, 3], 3, 60], [[0, 4, 10, 3], 50]),
  ('regression cascade direction #1', [[4, 2, 0, 3, 6], 4, 201], [[1, 0, 1, 0, 7], 70]),
  ('partial repair boundary #1', [[4, 22], 1, 30], [[1, 23], 10]),
  ('budget stops second tier #1', [[9, 1, 0], 2, 30], [[0, 4, 0], 30]),
  ('max tier untouched #1', [[0, 6], 1, 1000], [[0, 6], 0]),
  ('control #1', [[27, 2, 2], 2, 60], [[9, 8, 2], 60])],
 [('two level cascade #1', [[9, 0, 0], 2, 1000], [[0, 0, 1], 50]),
  ('fault site cascade direction #1', [[4, 4, 0, 9, 8], 4, 60], [[1, 2, 1, 9, 8], 30]),
  ('regression cascade direction #1', [[4, 2, 0, 3, 6], 4, 201], [[1, 0, 1, 0, 7], 70]),
  ('regression cascade direction #2', [[9, 8, 2, 9], 3, 277], [[0, 2, 2, 10], 120]),
  ('partial repair boundary #1', [[8, 2], 1, 60], [[2, 4], 20]),
  ('budget stops second tier #1', [[9, 1, 0], 2, 30], [[0, 4, 0], 30]),
  ('max tier untouched #1', [[0, 6], 1, 1000], [[0, 6], 0]),
  ('control #1', [[27, 2, 2], 2, 60], [[9, 8, 2], 60])],
 [('two level cascade #1', [[9, 0, 0], 2, 1000], [[0, 0, 1], 50]),
  ('regression cascade direction #1', [[9, 8, 2, 9], 3, 277], [[0, 2, 2, 10], 120]),
  ('fault site cascade direction #1', [[8, 8, 4, 0, 0], 4, 30], [[2, 10, 4, 0, 0], 20]),
  ('partial repair boundary #1', [[24, 3], 1, 1000], [[0, 11], 80]),
  ('regression cascade direction #2', [[8, 2, 0], 2, 83], [[2, 1, 1], 40]),
  ('budget stops second tier #1', [[9, 1, 0], 2, 30], [[0, 4, 0], 30]),
  ('max tier untouched #1', [[0, 6], 1, 1000], [[0, 6], 0]),
  ('control #1', [[9, 28, 24], 2, 10], [[6, 29, 24], 10])],
 [('two level cascade #1', [[9, 0, 0], 2, 1000], [[0, 0, 1], 50]),
  ('fault site cascade direction #1', [[27, 3, 9], 2, 30], [[18, 6, 9], 30]),
  ('regression cascade direction #1', [[8, 2, 0], 2, 83], [[2, 1, 1], 40]),
  ('partial repair boundary #1', [[3, 3], 1, 30], [[0, 4], 10]),
  ('partial repair boundary #2', [[24, 10], 1, 133], [[0, 18], 80]),
  ('budget stops second tier #1', [[9, 1, 0], 2, 30], [[0, 4, 0], 30]),
  ('max tier untouched #1', [[0, 6], 1, 1000], [[0, 6], 0]),
  ('control #1', [[0, 4, 7, 4], 3, 29], [[0, 1, 8, 4], 20])]]
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
two level cascade #1[[0, 3, 0], 30][[0, 0, 1], 50]Failed
regression cascade direction #1[[0, 3, 3], 50][[0, 0, 4], 70]Failed
fault site cascade direction #1[[4, 1, 4, 3, 9], 20][[1, 5, 3, 3, 9], 10]Failed
regression cascade direction #2[[1, 3, 0, 0, 7], 50][[1, 0, 1, 0, 7], 70]Failed
partial repair boundary #1[[1, 23], 10][[1, 23], 10]Passed
budget stops second tier #1[[0, 4, 0], 30][[0, 4, 0], 30]Passed
max tier untouched #1[[0, 6], 0][[0, 6], 0]Passed
control #1[[9, 8, 2], 60][[9, 8, 2], 60]Passed

SHA-256 / 1ce47717489269b7ad78e2b8dbe6c2085b001e1665a7dbc419ec7afe5269a588

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(gems, max_tier, budget):
    g = list(gems)
    gold = 0
    for t in range(max_tier - 1):
        price = (t + 1) * 10
        made = min(g[t] // 3, (budget - gold) // price)
        g[t] -= made * 3
        g[t + 1] += made
        gold += made * price
    return [g, gold]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('two level cascade #1', [[9, 0, 0], 2, 1000], [[0, 0, 1], 50]),
  ('regression cascade direction #1', [[9, 3, 2], 2, 1000], [[0, 0, 4], 70]),
  ('fault site cascade direction #1', [[4, 4, 3, 3, 9], 4, 29], [[1, 5, 3, 3, 9], 10]),
  ('regression cascade direction #2', [[4, 2, 0, 3, 6], 4, 201], [[1, 0, 1, 0, 7], 70]),
  ('partial repair boundary #1', [[4, 22], 1, 30], [[1, 23], 10]),
  ('budget stops second tier #1', [[9, 1, 0], 2, 30], [[0, 4, 0], 30]),
  ('max tier untouched #1', [[0, 6], 1, 1000], [[0, 6], 0]),
  ('control #1', [[27, 2, 2], 2, 60], [[9, 8, 2], 60])],
 [('two level cascade #1', [[9, 0, 0], 2, 1000], [[0, 0, 1], 50]),
  ('fault site cascade direction #1', [[4, 4, 3, 3, 9], 4, 29], [[1, 5, 3, 3, 9], 10]),
  ('fault site cascade direction #2', [[3, 9, 8, 3], 3, 60], [[0, 4, 10, 3], 50]),
  ('regression cascade direction #1', [[4, 2, 0, 3, 6], 4, 201], [[1, 0, 1, 0, 7], 70]),
  ('partial repair boundary #1', [[4, 22], 1, 30], [[1, 23], 10]),
  ('budget stops second tier #1', [[9, 1, 0], 2, 30], [[0, 4, 0], 30]),
  ('max tier untouched #1', [[0, 6], 1, 1000], [[0, 6], 0]),
  ('control #1', [[27, 2, 2], 2, 60], [[9, 8, 2], 60])],
 [('two level cascade #1', [[9, 0, 0], 2, 1000], [[0, 0, 1], 50]),
  ('fault site cascade direction #1', [[4, 4, 0, 9, 8], 4, 60], [[1, 2, 1, 9, 8], 30]),
  ('regression cascade direction #1', [[4, 2, 0, 3, 6], 4, 201], [[1, 0, 1, 0, 7], 70]),
  ('regression cascade direction #2', [[9, 8, 2, 9], 3, 277], [[0, 2, 2, 10], 120]),
  ('partial repair boundary #1', [[8, 2], 1, 60], [[2, 4], 20]),
  ('budget stops second tier #1', [[9, 1, 0], 2, 30], [[0, 4, 0], 30]),
  ('max tier untouched #1', [[0, 6], 1, 1000], [[0, 6], 0]),
  ('control #1', [[27, 2, 2], 2, 60], [[9, 8, 2], 60])],
 [('two level cascade #1', [[9, 0, 0], 2, 1000], [[0, 0, 1], 50]),
  ('regression cascade direction #1', [[9, 8, 2, 9], 3, 277], [[0, 2, 2, 10], 120]),
  ('fault site cascade direction #1', [[8, 8, 4, 0, 0], 4, 30], [[2, 10, 4, 0, 0], 20]),
  ('partial repair boundary #1', [[24, 3], 1, 1000], [[0, 11], 80]),
  ('regression cascade direction #2', [[8, 2, 0], 2, 83], [[2, 1, 1], 40]),
  ('budget stops second tier #1', [[9, 1, 0], 2, 30], [[0, 4, 0], 30]),
  ('max tier untouched #1', [[0, 6], 1, 1000], [[0, 6], 0]),
  ('control #1', [[9, 28, 24], 2, 10], [[6, 29, 24], 10])],
 [('two level cascade #1', [[9, 0, 0], 2, 1000], [[0, 0, 1], 50]),
  ('fault site cascade direction #1', [[27, 3, 9], 2, 30], [[18, 6, 9], 30]),
  ('regression cascade direction #1', [[8, 2, 0], 2, 83], [[2, 1, 1], 40]),
  ('partial repair boundary #1', [[3, 3], 1, 30], [[0, 4], 10]),
  ('partial repair boundary #2', [[24, 10], 1, 133], [[0, 18], 80]),
  ('budget stops second tier #1', [[9, 1, 0], 2, 30], [[0, 4, 0], 30]),
  ('max tier untouched #1', [[0, 6], 1, 1000], [[0, 6], 0]),
  ('control #1', [[0, 4, 7, 4], 3, 29], [[0, 1, 8, 4], 20])]]
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
two level cascade #1[[0, 3, 0], 30][[0, 0, 1], 50]Failed
regression cascade direction #1[[0, 6, 2], 30][[0, 0, 4], 70]Failed
fault site cascade direction #1[[1, 5, 3, 3, 9], 10][[1, 5, 3, 3, 9], 10]Passed
regression cascade direction #2[[1, 0, 1, 3, 6], 30][[1, 0, 1, 0, 7], 70]Failed
partial repair boundary #1[[4, 22], 0][[1, 23], 10]Failed
budget stops second tier #1[[0, 4, 0], 30][[0, 4, 0], 30]Passed
max tier untouched #1[[0, 6], 0][[0, 6], 0]Passed
control #1[[9, 8, 2], 60][[9, 8, 2], 60]Passed

SHA-256 / 8a842520119a41cf9afa6430b70f36f4ac2a0b7cae4f5a8ab8a83b25d4051ea9

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

Case digest / 1457b39457490a7018f35acfbf05f8fefee8239df8cedbc294f24d6396956011