FAILURE MAP
← Case archive

FA-86986 / Physics integrator stability / Open access

Step budget counter is not reset each frame · case 01

After a few frames the budget is exhausted permanently and physics stops.

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

ROOT CAUSE

n is initialised once before the frame loop.

THE FAILURE

n is initialised once before the frame loop.

Unsuccessful approach: Reporting per-frame differences of a global counter still exhausts the budget across frames.

Case contract

solve(frames, dt, max_frame, max_steps): game loop accumulator. Each frame delta is clamped to max_frame and added; run steps while acc >= dt up to max_steps; if a full dt still remains, whole multiples of dt are dropped (spiral-of-death guard). Return [steps per frame, acc/dt after last frame, dropped time].

Why this case matters

Game and robotics physics loops depend on integrator update order, step control and stabilization terms; a wrong decision point turns a stable simulation into drifting or exploding motion.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(frames, dt, max_frame, max_steps):
    acc = 0.0
    dropped = 0.0
    steps = []
    n = 0
    for delta in frames:
        acc += min(delta, max_frame)
        while acc >= dt and n < max_steps:
            acc -= dt
            n += 1
        if acc >= dt:
            keep = acc % dt
            dropped += acc - keep
            acc = keep
        steps.append(n)
    return [steps, acc / dt, dropped]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[0.25, 0.25, 0.125, 0.0], 0.03125, 0.125, 2], [[2, 2, 2, 0], 0.0, 0.1875]], [[[0.046875, 0.046875, 0.046875], 0.03125, 0.25, 1], [[1, 1, 1], 0.5, 0.03125]], [[[0.046875, 0.125, 0.0625, 0.0, 0.03125, 0.046875], 0.03125, 0.25, 5], [[1, 4, 2, 0, 1, 2], 0.0, 0.0]], [[[0.625, 0.046875, 0.625], 0.015625, 0.125, 1], [[1, 1, 1], 0.0, 0.25]], [[[0.015625], 0.015625, 0.25, 2], [[1], 0.0, 0.0]], [[[0.0625, 0.046875, 0.015625, 0.125], 0.0625, 0.125, 5], [[1, 0, 1, 2], 0.0, 0.0]], [[[0.0], 0.015625, 0.25, 2], [[0], 0.0, 0.0]], [[[0.0625], 0.03125, 0.25, 3], [[2], 0.0, 0.0]]], [[[[0.015625], 0.015625, 0.25, 2], [[1], 0.0, 0.0]], [[[0.015625, 0.0625, 0.015625, 0.046875, 0.015625, 0.03125], 0.015625, 0.25, 3], [[1, 3, 1, 3, 1, 2], 0.0, 0.015625]], [[[0.0, 0.25], 0.03125, 0.25, 5], [[0, 5], 0.0, 0.09375]], [[[0.0625, 0.03125, 0.015625], 0.0625, 0.25, 3], [[1, 0, 0], 0.75, 0.0]], [[[0.046875, 0.03125, 0.078125, 0.125], 0.03125, 0.125, 4], [[1, 1, 3, 4], 0.0, 0.0]], [[[0.0625, 0.125, 0.015625, 0.125], 0.03125, 0.25, 2], [[2, 2, 0, 2], 0.5, 0.125]], [[[0.078125, 0.125], 0.0625, 0.125, 1], [[1, 1], 0.25, 0.0625]], [[[0.0], 0.015625, 0.25, 2], [[0], 0.0, 0.0]]], [[[[0.0], 0.015625, 0.25, 2], [[0], 0.0, 0.0]], [[[0.015625], 0.015625, 0.25, 2], [[1], 0.0, 0.0]], [[[0.015625, 0.015625, 0.625, 0.078125], 0.03125, 0.125, 4], [[0, 1, 4, 2], 0.5, 0.0]], [[[0.046875, 0.125, 0.0, 0.0], 0.03125, 0.125, 5], [[1, 4, 0, 0], 0.5, 0.0]], [[[0.125, 0.625], 0.015625, 0.25, 5], [[5, 5], 0.0, 0.21875]], [[[0.625, 0.03125, 0.25, 0.625], 0.015625, 0.25, 3], [[3, 2, 3, 3], 0.0, 0.609375]], [[[0.25], 0.0625, 0.25, 4], [[4], 0.0, 0.0]], [[[0.625, 0.0625], 0.015625, 0.25, 2], [[2, 2], 0.0, 0.25]]], [[[[0.078125, 0.125, 0.25, 0.015625, 0.03125, 0.078125], 0.015625, 0.125, 5], [[5, 5, 5, 1, 2, 5], 0.0, 0.09375]], [[[0.078125, 0.015625, 0.046875], 0.015625, 0.25, 2], [[2, 1, 2], 0.0, 0.0625]], [[[0.0], 0.015625, 0.25, 2], [[0], 0.0, 0.0]], [[[0.015625], 0.015625, 0.25, 2], [[1], 0.0, 0.0]], [[[0.015625], 0.015625, 0.25, 5], [[1], 0.0, 0.0]], [[[0.625, 0.125, 0.125], 0.0625, 0.25, 1], [[1, 1, 1], 0.0, 0.3125]], [[[0.03125, 0.25, 0.125, 0.625, 0.125, 0.078125], 0.03125, 0.25, 4], [[1, 4, 4, 4, 4, 2], 0.5, 0.25]], [[[0.078125, 0.078125, 0.625, 0.078125], 0.015625, 0.125, 2], [[2, 2, 2, 2], 0.0, 0.234375]]], [[[[0.078125, 0.015625], 0.015625, 0.125, 5], [[5, 1], 0.0, 0.0]], [[[0.046875, 0.625, 0.0, 0.625, 0.25], 0.015625, 0.25, 4], [[3, 4, 0, 4, 4], 0.0, 0.5625]], [[[0.0], 0.015625, 0.25, 2], [[0], 0.0, 0.0]], [[[0.015625], 0.015625, 0.25, 2], [[1], 0.0, 0.0]], [[[0.0, 0.125, 0.25, 0.25], 0.03125, 0.125, 5], [[0, 4, 4, 4], 0.0, 0.0]], [[[0.015625], 0.0625, 0.25, 3], [[0], 0.25, 0.0]], [[[0.125, 0.625, 0.0, 0.25], 0.0625, 0.125, 4], [[2, 2, 0, 2], 0.0, 0.0]], [[[0.03125, 0.125, 0.03125], 0.03125, 0.125, 3], [[1, 3, 1], 0.0, 0.03125]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("case %d" % i, 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
case 0[[2, 2, 2, 2], 0.0, 0.3125][[2, 2, 2, 0], 0.0, 0.1875]Failed
case 1[[1, 1, 1], 0.5, 0.09375][[1, 1, 1], 0.5, 0.03125]Failed
case 2[[1, 5, 5, 5, 5, 5], 0.0, 0.15625][[1, 4, 2, 0, 1, 2], 0.0, 0.0]Failed
case 3[[1, 1, 1], 0.0, 0.28125][[1, 1, 1], 0.0, 0.25]Failed
case 4[[1], 0.0, 0.0][[1], 0.0, 0.0]Passed
case 5[[1, 1, 2, 4], 0.0, 0.0][[1, 0, 1, 2], 0.0, 0.0]Failed
case 6[[0], 0.0, 0.0][[0], 0.0, 0.0]Passed
case 7[[2], 0.0, 0.0][[2], 0.0, 0.0]Passed

SHA-256 / b68b5a2029455c70b7b46a4f77971c244feb50de9601bb78fb58e04bc43cfd91

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(frames, dt, max_frame, max_steps):
    acc = 0.0
    dropped = 0.0
    steps = []
    n = 0
    for delta in frames:
        acc += min(delta, max_frame)
        while acc >= dt and n < max_steps:
            acc -= dt
            n += 1
        if acc >= dt:
            keep = acc % dt
            dropped += acc - keep
            acc = keep
        steps.append(n - sum(steps))
    return [steps, acc / dt, dropped]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[0.25, 0.25, 0.125, 0.0], 0.03125, 0.125, 2], [[2, 2, 2, 0], 0.0, 0.1875]], [[[0.046875, 0.046875, 0.046875], 0.03125, 0.25, 1], [[1, 1, 1], 0.5, 0.03125]], [[[0.046875, 0.125, 0.0625, 0.0, 0.03125, 0.046875], 0.03125, 0.25, 5], [[1, 4, 2, 0, 1, 2], 0.0, 0.0]], [[[0.625, 0.046875, 0.625], 0.015625, 0.125, 1], [[1, 1, 1], 0.0, 0.25]], [[[0.015625], 0.015625, 0.25, 2], [[1], 0.0, 0.0]], [[[0.0625, 0.046875, 0.015625, 0.125], 0.0625, 0.125, 5], [[1, 0, 1, 2], 0.0, 0.0]], [[[0.0], 0.015625, 0.25, 2], [[0], 0.0, 0.0]], [[[0.0625], 0.03125, 0.25, 3], [[2], 0.0, 0.0]]], [[[[0.015625], 0.015625, 0.25, 2], [[1], 0.0, 0.0]], [[[0.015625, 0.0625, 0.015625, 0.046875, 0.015625, 0.03125], 0.015625, 0.25, 3], [[1, 3, 1, 3, 1, 2], 0.0, 0.015625]], [[[0.0, 0.25], 0.03125, 0.25, 5], [[0, 5], 0.0, 0.09375]], [[[0.0625, 0.03125, 0.015625], 0.0625, 0.25, 3], [[1, 0, 0], 0.75, 0.0]], [[[0.046875, 0.03125, 0.078125, 0.125], 0.03125, 0.125, 4], [[1, 1, 3, 4], 0.0, 0.0]], [[[0.0625, 0.125, 0.015625, 0.125], 0.03125, 0.25, 2], [[2, 2, 0, 2], 0.5, 0.125]], [[[0.078125, 0.125], 0.0625, 0.125, 1], [[1, 1], 0.25, 0.0625]], [[[0.0], 0.015625, 0.25, 2], [[0], 0.0, 0.0]]], [[[[0.0], 0.015625, 0.25, 2], [[0], 0.0, 0.0]], [[[0.015625], 0.015625, 0.25, 2], [[1], 0.0, 0.0]], [[[0.015625, 0.015625, 0.625, 0.078125], 0.03125, 0.125, 4], [[0, 1, 4, 2], 0.5, 0.0]], [[[0.046875, 0.125, 0.0, 0.0], 0.03125, 0.125, 5], [[1, 4, 0, 0], 0.5, 0.0]], [[[0.125, 0.625], 0.015625, 0.25, 5], [[5, 5], 0.0, 0.21875]], [[[0.625, 0.03125, 0.25, 0.625], 0.015625, 0.25, 3], [[3, 2, 3, 3], 0.0, 0.609375]], [[[0.25], 0.0625, 0.25, 4], [[4], 0.0, 0.0]], [[[0.625, 0.0625], 0.015625, 0.25, 2], [[2, 2], 0.0, 0.25]]], [[[[0.078125, 0.125, 0.25, 0.015625, 0.03125, 0.078125], 0.015625, 0.125, 5], [[5, 5, 5, 1, 2, 5], 0.0, 0.09375]], [[[0.078125, 0.015625, 0.046875], 0.015625, 0.25, 2], [[2, 1, 2], 0.0, 0.0625]], [[[0.0], 0.015625, 0.25, 2], [[0], 0.0, 0.0]], [[[0.015625], 0.015625, 0.25, 2], [[1], 0.0, 0.0]], [[[0.015625], 0.015625, 0.25, 5], [[1], 0.0, 0.0]], [[[0.625, 0.125, 0.125], 0.0625, 0.25, 1], [[1, 1, 1], 0.0, 0.3125]], [[[0.03125, 0.25, 0.125, 0.625, 0.125, 0.078125], 0.03125, 0.25, 4], [[1, 4, 4, 4, 4, 2], 0.5, 0.25]], [[[0.078125, 0.078125, 0.625, 0.078125], 0.015625, 0.125, 2], [[2, 2, 2, 2], 0.0, 0.234375]]], [[[[0.078125, 0.015625], 0.015625, 0.125, 5], [[5, 1], 0.0, 0.0]], [[[0.046875, 0.625, 0.0, 0.625, 0.25], 0.015625, 0.25, 4], [[3, 4, 0, 4, 4], 0.0, 0.5625]], [[[0.0], 0.015625, 0.25, 2], [[0], 0.0, 0.0]], [[[0.015625], 0.015625, 0.25, 2], [[1], 0.0, 0.0]], [[[0.0, 0.125, 0.25, 0.25], 0.03125, 0.125, 5], [[0, 4, 4, 4], 0.0, 0.0]], [[[0.015625], 0.0625, 0.25, 3], [[0], 0.25, 0.0]], [[[0.125, 0.625, 0.0, 0.25], 0.0625, 0.125, 4], [[2, 2, 0, 2], 0.0, 0.0]], [[[0.03125, 0.125, 0.03125], 0.03125, 0.125, 3], [[1, 3, 1], 0.0, 0.03125]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("case %d" % i, 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
case 0[[2, 0, 0, 0], 0.0, 0.3125][[2, 2, 2, 0], 0.0, 0.1875]Failed
case 1[[1, 0, 0], 0.5, 0.09375][[1, 1, 1], 0.5, 0.03125]Failed
case 2[[1, 4, 0, 0, 0, 0], 0.0, 0.15625][[1, 4, 2, 0, 1, 2], 0.0, 0.0]Failed
case 3[[1, 0, 0], 0.0, 0.28125][[1, 1, 1], 0.0, 0.25]Failed
case 4[[1], 0.0, 0.0][[1], 0.0, 0.0]Passed
case 5[[1, 0, 1, 2], 0.0, 0.0][[1, 0, 1, 2], 0.0, 0.0]Passed
case 6[[0], 0.0, 0.0][[0], 0.0, 0.0]Passed
case 7[[2], 0.0, 0.0][[2], 0.0, 0.0]Passed

SHA-256 / 6abe02d92a0161ccea4039a8ae4176bac89ef77d4c2f37c65f854bfcfde6867f

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

A deterministic bounded teaching model with stipulated toy conventions and rounded float output; not a production physics engine or a proof of numerical stability. 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:54.629047+00:00.

Case digest / fac647258a30b16fd48824cd2e805943af4e3a2df8977e377e1db4d4699594e0