FAILURE MAP
← Case archive

FA-86291 / Game economy crafting balance / Open access

Crafting station queue: Jobs are dealt round-robin · case 01

A long job blocks its station while another sits idle.

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

ROOT CAUSE

Stations are assigned by queue position rather than earliest free time.

THE FAILURE

Stations are assigned by queue position rather than earliest free time.

Unsuccessful approach: Keying on station index first always selects station zero.

Case contract

jobs = [[name, duration], ...] in queue order. Effective duration = max(1, floor(duration*(100-speed)/100)). Each job starts on the station that frees earliest (lowest index on ties) at that station free time. Return names of jobs finished by now (finish <= now) ordered by finish time then queue position.

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(jobs, stations, speed, now):
    free = [0] * stations
    done = []
    for idx, (name, dur) in enumerate(jobs):
        d = max(1, dur * (100 - speed) // 100)
        s = idx % stations
        start = free[s]
        free[s] = start + d
        done.append((free[s], idx, name))
    return [name for fin, idx, name in sorted(done) if fin <= now]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('two stations tie #1', [[['a', 10], ['b', 10], ['c', 5]], 2, 0, 15], ['a', 'b', 'c']),
  ('regression station selection #1',
   [[['flask', 2], ['bow', 10], ['cape', 1], ['dagger', 2], ['anvil', 10], ['ember', 10]], 2, 10, 5],
   ['flask', 'cape', 'dagger']),
  ('regression station selection #2',
   [[['cape', 1], ['dagger', 73], ['bow', 1], ['anvil', 2], ['flask', 5], ['ember', 32]], 2, 0, 5],
   ['cape', 'bow', 'anvil']),
  ('partial repair boundary #1',
   [[['anvil', 2], ['flask', 2], ['cape', 1], ['dagger', 103], ['ember', 5]], 2, 10, 60],
   ['anvil', 'flask', 'cape', 'ember']),
  ('partial repair boundary #2',
   [[['anvil', 10], ['bow', 1], ['dagger', 10], ['cape', 60]], 2, 25, 1],
   ['bow']),
  ('speed floor #1', [[['x', 1], ['y', 1]], 1, 90, 2], ['x', 'y']),
  ('finish exactly now #1', [[['a', 30]], 1, 0, 30], ['a']),
  ('control #1',
   [[['flask', 1], ['cape', 60], ['ember', 1], ['bow', 1], ['anvil', 2], ['dagger', 33]], 2, 25, 1],
   ['flask'])],
 [('two stations tie #1', [[['a', 10], ['b', 10], ['c', 5]], 2, 0, 15], ['a', 'b', 'c']),
  ('regression station selection #1',
   [[['anvil', 2], ['cape', 60], ['bow', 5], ['ember', 1]], 2, 50, 5],
   ['anvil', 'bow', 'ember']),
  ('regression station selection #2',
   [[['flask', 5], ['bow', 10], ['anvil', 1], ['dagger', 2], ['cape', 78]], 2, 50, 208],
   ['flask', 'anvil', 'dagger', 'bow', 'cape']),
  ('partial repair boundary #1',
   [[['anvil', 2], ['flask', 2], ['cape', 1], ['dagger', 103], ['ember', 5]], 2, 10, 60],
   ['anvil', 'flask', 'cape', 'ember']),
  ('partial repair boundary #2',
   [[['anvil', 10], ['bow', 1], ['dagger', 10], ['cape', 60]], 2, 25, 1],
   ['bow']),
  ('speed floor #1', [[['x', 1], ['y', 1]], 1, 90, 2], ['x', 'y']),
  ('finish exactly now #1', [[['a', 30]], 1, 0, 30], ['a']),
  ('control #1',
   [[['flask', 1], ['cape', 60], ['ember', 1], ['bow', 1], ['anvil', 2], ['dagger', 33]], 2, 25, 1],
   ['flask'])],
 [('two stations tie #1', [[['a', 10], ['b', 10], ['c', 5]], 2, 0, 15], ['a', 'b', 'c']),
  ('regression station selection #1',
   [[['bow', 60], ['anvil', 60], ['ember', 5], ['dagger', 5]], 3, 0, 133],
   ['ember', 'dagger', 'bow', 'anvil']),
  ('regression station selection #2',
   [[['dagger', 1], ['anvil', 100], ['ember', 60], ['bow', 1], ['flask', 1], ['cape', 5]], 3, 0, 30],
   ['dagger', 'bow', 'flask', 'cape']),
  ('regression station selection #3',
   [[['cape', 1], ['dagger', 73], ['bow', 1], ['anvil', 2], ['flask', 5], ['ember', 32]], 2, 0, 5],
   ['cape', 'bow', 'anvil']),
  ('partial repair boundary #1',
   [[['anvil', 10], ['bow', 60], ['cape', 10]], 2, 50, 260],
   ['anvil', 'cape', 'bow']),
  ('speed floor #1', [[['x', 1], ['y', 1]], 1, 90, 2], ['x', 'y']),
  ('finish exactly now #1', [[['a', 30]], 1, 0, 30], ['a']),
  ('control #1',
   [[['flask', 1], ['cape', 60], ['ember', 1], ['bow', 1], ['anvil', 2], ['dagger', 33]], 2, 25, 1],
   ['flask'])],
 [('two stations tie #1', [[['a', 10], ['b', 10], ['c', 5]], 2, 0, 15], ['a', 'b', 'c']),
  ('regression station selection #1',
   [[['bow', 1], ['anvil', 60], ['flask', 2], ['dagger', 1], ['ember', 1]], 2, 50, 5],
   ['bow', 'flask', 'dagger', 'ember']),
  ('regression station selection #2',
   [[['ember', 60], ['anvil', 1], ['dagger', 1], ['cape', 1], ['bow', 1], ['flask', 2]], 2, 90, 60],
   ['anvil', 'dagger', 'cape', 'bow', 'flask', 'ember']),
  ('regression station selection #3',
   [[['anvil', 2], ['cape', 60], ['bow', 5], ['ember', 1]], 2, 50, 5],
   ['anvil', 'bow', 'ember']),
  ('regression station selection #4',
   [[['flask', 5], ['bow', 10], ['anvil', 1], ['dagger', 2], ['cape', 78]], 2, 50, 208],
   ['flask', 'anvil', 'dagger', 'bow', 'cape']),
  ('speed floor #1', [[['x', 1], ['y', 1]], 1, 90, 2], ['x', 'y']),
  ('finish exactly now #1', [[['a', 30]], 1, 0, 30], ['a']),
  ('control #1',
   [[['dagger', 10], ['bow', 119], ['cape', 1], ['flask', 2], ['ember', 60], ['anvil', 5]], 1, 0, 60],
   ['dagger'])],
 [('two stations tie #1', [[['a', 10], ['b', 10], ['c', 5]], 2, 0, 15], ['a', 'b', 'c']),
  ('regression station selection #1',
   [[['anvil', 10], ['dagger', 19], ['flask', 2], ['cape', 60], ['ember', 90], ['bow', 5]], 3, 25, 60],
   ['flask', 'anvil', 'dagger', 'bow', 'cape']),
  ('regression station selection #2',
   [[['ember', 10], ['cape', 60], ['bow', 1], ['flask', 5], ['dagger', 1], ['anvil', 2]], 2, 0, 30],
   ['ember', 'bow', 'flask', 'dagger', 'anvil']),
  ('partial repair boundary #1', [[['ember', 1], ['cape', 1], ['bow', 60]], 3, 50, 1], ['ember', 'cape']),
  ('regression station selection #3',
   [[['bow', 60], ['anvil', 60], ['ember', 5], ['dagger', 5]], 3, 0, 133],
   ['ember', 'dagger', 'bow', 'anvil']),
  ('speed floor #1', [[['x', 1], ['y', 1]], 1, 90, 2], ['x', 'y']),
  ('finish exactly now #1', [[['a', 30]], 1, 0, 30], ['a']),
  ('control #1', [[['dagger', 1], ['bow', 5]], 1, 99, 161], ['dagger', 'bow'])]]
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 stations tie #1['a', 'b', 'c']['a', 'b', 'c']Passed
regression station selection #1['flask', 'cape']['flask', 'cape', 'dagger']Failed
regression station selection #2['cape', 'bow']['cape', 'bow', 'anvil']Failed
partial repair boundary #1['anvil', 'flask', 'cape', 'ember']['anvil', 'flask', 'cape', 'ember']Passed
partial repair boundary #2['bow']['bow']Passed
speed floor #1['x', 'y']['x', 'y']Passed
finish exactly now #1['a']['a']Passed
control #1['flask']['flask']Passed

SHA-256 / 5d3ebad27d8a2e383d61e3e1da81c3eae9548eb8b3ef089ad8e3990a3cf70b4a

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(jobs, stations, speed, now):
    free = [0] * stations
    done = []
    for idx, (name, dur) in enumerate(jobs):
        d = max(1, dur * (100 - speed) // 100)
        s = min(range(stations), key=lambda k: (k, free[k]))
        start = free[s]
        free[s] = start + d
        done.append((free[s], idx, name))
    return [name for fin, idx, name in sorted(done) if fin <= now]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('two stations tie #1', [[['a', 10], ['b', 10], ['c', 5]], 2, 0, 15], ['a', 'b', 'c']),
  ('regression station selection #1',
   [[['flask', 2], ['bow', 10], ['cape', 1], ['dagger', 2], ['anvil', 10], ['ember', 10]], 2, 10, 5],
   ['flask', 'cape', 'dagger']),
  ('regression station selection #2',
   [[['cape', 1], ['dagger', 73], ['bow', 1], ['anvil', 2], ['flask', 5], ['ember', 32]], 2, 0, 5],
   ['cape', 'bow', 'anvil']),
  ('partial repair boundary #1',
   [[['anvil', 2], ['flask', 2], ['cape', 1], ['dagger', 103], ['ember', 5]], 2, 10, 60],
   ['anvil', 'flask', 'cape', 'ember']),
  ('partial repair boundary #2',
   [[['anvil', 10], ['bow', 1], ['dagger', 10], ['cape', 60]], 2, 25, 1],
   ['bow']),
  ('speed floor #1', [[['x', 1], ['y', 1]], 1, 90, 2], ['x', 'y']),
  ('finish exactly now #1', [[['a', 30]], 1, 0, 30], ['a']),
  ('control #1',
   [[['flask', 1], ['cape', 60], ['ember', 1], ['bow', 1], ['anvil', 2], ['dagger', 33]], 2, 25, 1],
   ['flask'])],
 [('two stations tie #1', [[['a', 10], ['b', 10], ['c', 5]], 2, 0, 15], ['a', 'b', 'c']),
  ('regression station selection #1',
   [[['anvil', 2], ['cape', 60], ['bow', 5], ['ember', 1]], 2, 50, 5],
   ['anvil', 'bow', 'ember']),
  ('regression station selection #2',
   [[['flask', 5], ['bow', 10], ['anvil', 1], ['dagger', 2], ['cape', 78]], 2, 50, 208],
   ['flask', 'anvil', 'dagger', 'bow', 'cape']),
  ('partial repair boundary #1',
   [[['anvil', 2], ['flask', 2], ['cape', 1], ['dagger', 103], ['ember', 5]], 2, 10, 60],
   ['anvil', 'flask', 'cape', 'ember']),
  ('partial repair boundary #2',
   [[['anvil', 10], ['bow', 1], ['dagger', 10], ['cape', 60]], 2, 25, 1],
   ['bow']),
  ('speed floor #1', [[['x', 1], ['y', 1]], 1, 90, 2], ['x', 'y']),
  ('finish exactly now #1', [[['a', 30]], 1, 0, 30], ['a']),
  ('control #1',
   [[['flask', 1], ['cape', 60], ['ember', 1], ['bow', 1], ['anvil', 2], ['dagger', 33]], 2, 25, 1],
   ['flask'])],
 [('two stations tie #1', [[['a', 10], ['b', 10], ['c', 5]], 2, 0, 15], ['a', 'b', 'c']),
  ('regression station selection #1',
   [[['bow', 60], ['anvil', 60], ['ember', 5], ['dagger', 5]], 3, 0, 133],
   ['ember', 'dagger', 'bow', 'anvil']),
  ('regression station selection #2',
   [[['dagger', 1], ['anvil', 100], ['ember', 60], ['bow', 1], ['flask', 1], ['cape', 5]], 3, 0, 30],
   ['dagger', 'bow', 'flask', 'cape']),
  ('regression station selection #3',
   [[['cape', 1], ['dagger', 73], ['bow', 1], ['anvil', 2], ['flask', 5], ['ember', 32]], 2, 0, 5],
   ['cape', 'bow', 'anvil']),
  ('partial repair boundary #1',
   [[['anvil', 10], ['bow', 60], ['cape', 10]], 2, 50, 260],
   ['anvil', 'cape', 'bow']),
  ('speed floor #1', [[['x', 1], ['y', 1]], 1, 90, 2], ['x', 'y']),
  ('finish exactly now #1', [[['a', 30]], 1, 0, 30], ['a']),
  ('control #1',
   [[['flask', 1], ['cape', 60], ['ember', 1], ['bow', 1], ['anvil', 2], ['dagger', 33]], 2, 25, 1],
   ['flask'])],
 [('two stations tie #1', [[['a', 10], ['b', 10], ['c', 5]], 2, 0, 15], ['a', 'b', 'c']),
  ('regression station selection #1',
   [[['bow', 1], ['anvil', 60], ['flask', 2], ['dagger', 1], ['ember', 1]], 2, 50, 5],
   ['bow', 'flask', 'dagger', 'ember']),
  ('regression station selection #2',
   [[['ember', 60], ['anvil', 1], ['dagger', 1], ['cape', 1], ['bow', 1], ['flask', 2]], 2, 90, 60],
   ['anvil', 'dagger', 'cape', 'bow', 'flask', 'ember']),
  ('regression station selection #3',
   [[['anvil', 2], ['cape', 60], ['bow', 5], ['ember', 1]], 2, 50, 5],
   ['anvil', 'bow', 'ember']),
  ('regression station selection #4',
   [[['flask', 5], ['bow', 10], ['anvil', 1], ['dagger', 2], ['cape', 78]], 2, 50, 208],
   ['flask', 'anvil', 'dagger', 'bow', 'cape']),
  ('speed floor #1', [[['x', 1], ['y', 1]], 1, 90, 2], ['x', 'y']),
  ('finish exactly now #1', [[['a', 30]], 1, 0, 30], ['a']),
  ('control #1',
   [[['dagger', 10], ['bow', 119], ['cape', 1], ['flask', 2], ['ember', 60], ['anvil', 5]], 1, 0, 60],
   ['dagger'])],
 [('two stations tie #1', [[['a', 10], ['b', 10], ['c', 5]], 2, 0, 15], ['a', 'b', 'c']),
  ('regression station selection #1',
   [[['anvil', 10], ['dagger', 19], ['flask', 2], ['cape', 60], ['ember', 90], ['bow', 5]], 3, 25, 60],
   ['flask', 'anvil', 'dagger', 'bow', 'cape']),
  ('regression station selection #2',
   [[['ember', 10], ['cape', 60], ['bow', 1], ['flask', 5], ['dagger', 1], ['anvil', 2]], 2, 0, 30],
   ['ember', 'bow', 'flask', 'dagger', 'anvil']),
  ('partial repair boundary #1', [[['ember', 1], ['cape', 1], ['bow', 60]], 3, 50, 1], ['ember', 'cape']),
  ('regression station selection #3',
   [[['bow', 60], ['anvil', 60], ['ember', 5], ['dagger', 5]], 3, 0, 133],
   ['ember', 'dagger', 'bow', 'anvil']),
  ('speed floor #1', [[['x', 1], ['y', 1]], 1, 90, 2], ['x', 'y']),
  ('finish exactly now #1', [[['a', 30]], 1, 0, 30], ['a']),
  ('control #1', [[['dagger', 1], ['bow', 5]], 1, 99, 161], ['dagger', 'bow'])]]
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 stations tie #1['a']['a', 'b', 'c']Failed
regression station selection #1['flask']['flask', 'cape', 'dagger']Failed
regression station selection #2['cape']['cape', 'bow', 'anvil']Failed
partial repair boundary #1['anvil', 'flask', 'cape']['anvil', 'flask', 'cape', 'ember']Failed
partial repair boundary #2[]['bow']Failed
speed floor #1['x', 'y']['x', 'y']Passed
finish exactly now #1['a']['a']Passed
control #1['flask']['flask']Passed

SHA-256 / bc40624b33f2440aeca46c8163a01a2acc319211689736c7e44dd3e645af50ec

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

Case digest / f9956cfc125a47e7ef6a6a18e61c23f6c1f9461423c97267a6defcafa2ae59d9