broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(length, encounters, min_gap, rest_every):
    out = []
    last = 0
    for pos in sorted(set(encounters)):
        if pos < 1 or pos > length - 1:
            continue
        if rest_every and pos % rest_every == 0:
            continue
        anchor = last
        if rest_every:
            anchor = max(anchor, pos // rest_every * rest_every)
        if pos - anchor < min_gap:
            continue
        out.append(pos)
        last = pos
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('fault site exit exclusion #1', [27, [20, 6, 10, 15, 26, -2, 12, 27, -1], 0, 0], [6, 10, 12, 15, 20]),
  ('fault site exit exclusion #2', [14, [4, 9, 16, 9, 16, 7, 8, 16, 0, 13], 1, 5], [4, 7, 8, 9]),
  ('partial repair boundary #1', [5, [4, 3, 1, 6, 0, 1, 3, 4], 3, 0], [3]),
  ('partial repair boundary #2', [5, [4, 5, 0, 7, 4, 3], 1, 4], [3]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('control #1', [21, [-2, 16], 2, 5], [])],
 [('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('fault site exit exclusion #1', [14, [4, 9, 16, 9, 16, 7, 8, 16, 0, 13], 1, 5], [4, 7, 8, 9]),
  ('fault site exit exclusion #2', [40, [41, 39, 8, 9, 9, 32, 18, 41], 5, 0], [8, 18, 32]),
  ('partial repair boundary #1', [5, [4, 5, 0, 7, 4, 3], 1, 4], [3]),
  ('partial repair boundary #2', [5, [5, 0, 4, 3, 7], 3, 0], [3]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('control #1', [21, [-2, 16], 2, 5], [])],
 [('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('fault site exit exclusion #1', [10, [1, 3, 6, 0, 12, 9, 7, -1], 3, 0], [3, 6]),
  ('fault site exit exclusion #2', [14, [11, 0, 11, 6, 13, 15, 15, 3], 5, 7], [6]),
  ('regression exit exclusion #1', [20, [16, 11, 18, 18, -2, 4, 21, 19, 21], 0, 0], [4, 11, 16, 18]),
  ('partial repair boundary #1', [11, [-2, 9, 11], 0, 5], [9]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('control #1', [21, [-2, 16], 2, 5], [])],
 [('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('regression exit exclusion #1', [20, [16, 11, 18, 18, -2, 4, 21, 19, 21], 0, 0], [4, 11, 16, 18]),
  ('fault site exit exclusion #1', [14, [13, -1, 2, 6], 0, 7], [2, 6]),
  ('partial repair boundary #1', [13, [15, 4, 0, 6, 1, 2, 1, 14, 11], 2, 0], [2, 4, 6, 11]),
  ('partial repair boundary #2', [12, [7, 2, 14, 6, 14, 14, 10], 1, 7], [2, 6, 10]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('control #1', [34, [-1, 30, 25, 20, 1, 11, 0], 5, 4], [])],
 [('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('fault site exit exclusion #1', [8, [3, 2, 8, 9, 7, -2, 0, 1], 2, 0], [2]),
  ('fault site exit exclusion #2', [12, [2, 1, 11], 5, 0], []),
  ('partial repair boundary #1', [15, [3, 15, 2, 13], 2, 5], [2, 13]),
  ('regression exit exclusion #1', [5, [-2, 6, 4, 3, 7, 5, -1, 1, 2, -2], 1, 0], [1, 2, 3]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('control #1', [40, [3, 4], 3, 0], [3])]]
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(length, encounters, min_gap, rest_every):
    out = []
    last = 0
    for pos in sorted(set(encounters)):
        if pos < 1 or pos >= length - 2:
            continue
        if rest_every and pos % rest_every == 0:
            continue
        anchor = last
        if rest_every:
            anchor = max(anchor, pos // rest_every * rest_every)
        if pos - anchor < min_gap:
            continue
        out.append(pos)
        last = pos
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('fault site exit exclusion #1', [27, [20, 6, 10, 15, 26, -2, 12, 27, -1], 0, 0], [6, 10, 12, 15, 20]),
  ('fault site exit exclusion #2', [14, [4, 9, 16, 9, 16, 7, 8, 16, 0, 13], 1, 5], [4, 7, 8, 9]),
  ('partial repair boundary #1', [5, [4, 3, 1, 6, 0, 1, 3, 4], 3, 0], [3]),
  ('partial repair boundary #2', [5, [4, 5, 0, 7, 4, 3], 1, 4], [3]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('control #1', [21, [-2, 16], 2, 5], [])],
 [('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('fault site exit exclusion #1', [14, [4, 9, 16, 9, 16, 7, 8, 16, 0, 13], 1, 5], [4, 7, 8, 9]),
  ('fault site exit exclusion #2', [40, [41, 39, 8, 9, 9, 32, 18, 41], 5, 0], [8, 18, 32]),
  ('partial repair boundary #1', [5, [4, 5, 0, 7, 4, 3], 1, 4], [3]),
  ('partial repair boundary #2', [5, [5, 0, 4, 3, 7], 3, 0], [3]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('control #1', [21, [-2, 16], 2, 5], [])],
 [('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('fault site exit exclusion #1', [10, [1, 3, 6, 0, 12, 9, 7, -1], 3, 0], [3, 6]),
  ('fault site exit exclusion #2', [14, [11, 0, 11, 6, 13, 15, 15, 3], 5, 7], [6]),
  ('regression exit exclusion #1', [20, [16, 11, 18, 18, -2, 4, 21, 19, 21], 0, 0], [4, 11, 16, 18]),
  ('partial repair boundary #1', [11, [-2, 9, 11], 0, 5], [9]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('control #1', [21, [-2, 16], 2, 5], [])],
 [('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('regression exit exclusion #1', [20, [16, 11, 18, 18, -2, 4, 21, 19, 21], 0, 0], [4, 11, 16, 18]),
  ('fault site exit exclusion #1', [14, [13, -1, 2, 6], 0, 7], [2, 6]),
  ('partial repair boundary #1', [13, [15, 4, 0, 6, 1, 2, 1, 14, 11], 2, 0], [2, 4, 6, 11]),
  ('partial repair boundary #2', [12, [7, 2, 14, 6, 14, 14, 10], 1, 7], [2, 6, 10]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('control #1', [34, [-1, 30, 25, 20, 1, 11, 0], 5, 4], [])],
 [('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('fault site exit exclusion #1', [8, [3, 2, 8, 9, 7, -2, 0, 1], 2, 0], [2]),
  ('fault site exit exclusion #2', [12, [2, 1, 11], 5, 0], []),
  ('partial repair boundary #1', [15, [3, 15, 2, 13], 2, 5], [2, 13]),
  ('regression exit exclusion #1', [5, [-2, 6, 4, 3, 7, 5, -1, 1, 2, -2], 1, 0], [1, 2, 3]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('control #1', [40, [3, 4], 3, 0], [3])]]
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)

prompt:
Players fight on the level exit.

Proposed positions are deduplicated and taken ascending. A position is legal when 1 <= pos <= length-2, is not a rest checkpoint (pos % rest_every == 0 when rest_every > 0), and lies at least min_gap after the anchor: the later of the last accepted encounter (initially the start, 0) and the last checkpoint at or before pos. Returns accepted positions.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(length, encounters, min_gap, rest_every):
    out = []
    last = 0
    for pos in sorted(set(encounters)):
        if pos < 1 or pos > length - 2:
            continue
        if rest_every and pos % rest_every == 0:
            continue
        anchor = last
        if rest_every:
            anchor = max(anchor, rest_every)
        if pos - anchor < min_gap:
            continue
        out.append(pos)
        last = pos
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site checkpoint anchor #1', [21, [-2, 16], 2, 5], []),
  ('fault site checkpoint anchor #2', [34, [-1, 30, 25, 20, 1, 11, 0], 5, 4], []),
  ('partial repair boundary #1', [39, [34, 15, 35, 19, 4], 2, 4], [15, 19, 34]),
  ('regression checkpoint anchor #1', [22, [17, 15, -1, 24, 7, 1, -2, 18, 2], 2, 7], [2, 17]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [27, [20, 6, 10, 15, 26, -2, 12, 27, -1], 0, 0], [6, 10, 12, 15, 20])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site checkpoint anchor #1', [34, [-1, 30, 25, 20, 1, 11, 0], 5, 4], []),
  ('fault site checkpoint anchor #2', [14, [4, 9, 16, 9, 16, 7, 8, 16, 0, 13], 1, 5], [4, 7, 8, 9]),
  ('regression checkpoint anchor #1', [15, [3, 15, 2, 13], 2, 5], [2, 13]),
  ('regression checkpoint anchor #2', [24, [21, 26, 23, 10, 18, 9, 17, 19], 2, 4], [10, 18]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [27, [20, 6, 10, 15, 26, -2, 12, 27, -1], 0, 0], [6, 10, 12, 15, 20])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site checkpoint anchor #1', [4, [1, -2, 1], 0, 7], [1]),
  ('fault site checkpoint anchor #2', [38, [27, 16, 11, 3], 0, 7], [3, 11, 16, 27]),
  ('regression checkpoint anchor #1', [22, [4, -1, 2, 3, 22], 2, 7], [2, 4]),
  ('regression checkpoint anchor #2', [23, [13, 20, 7, 12, 21, 15, 11, 19, 5], 2, 7], [5, 11, 13, 19]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [27, [20, 6, 10, 15, 26, -2, 12, 27, -1], 0, 0], [6, 10, 12, 15, 20])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site checkpoint anchor #1', [29, [13, 16], 3, 5], [13]),
  ('regression checkpoint anchor #1', [22, [17, 15, -1, 24, 7, 1, -2, 18, 2], 2, 7], [2, 17]),
  ('regression checkpoint anchor #2', [14, [5, 13, 6, 10, 8, 8], 3, 7], [5, 10]),
  ('regression checkpoint anchor #3', [13, [11, 14, 8, 0, 6, 4, 3, 10, 7, 5], 3, 7], [3, 6, 10]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [40, [41, 39, 8, 9, 9, 32, 18, 41], 5, 0], [8, 18, 32])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site checkpoint anchor #1', [14, [11, 0, 11, 6, 13, 15, 15, 3], 5, 7], [6]),
  ('fault site checkpoint anchor #2', [19, [6, 20, 0, 10, 4, 6, 2, 14, 9], 0, 7], [2, 4, 6, 9, 10]),
  ('regression checkpoint anchor #1', [22, [12, -2, 3, 4, 2, 14, 15, -1, 15, 16], 2, 4], [2, 14]),
  ('regression checkpoint anchor #2', [34, [32, 28, 21, 18, 3, 26, 15, 19, 3], 3, 5], [3, 18, 28]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [40, [3, 4], 3, 0], [3])]]
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

prompt:
Later rest stops do not give breathing room.

Proposed positions are deduplicated and taken ascending. A position is legal when 1 <= pos <= length-2, is not a rest checkpoint (pos % rest_every == 0 when rest_every > 0), and lies at least min_gap after the anchor: the later of the last accepted encounter (initially the start, 0) and the last checkpoint at or before pos. Returns accepted positions.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(length, encounters, min_gap, rest_every):
    out = []
    last = -min_gap
    for pos in sorted(set(encounters)):
        if pos < 1 or pos > length - 2:
            continue
        if rest_every and pos % rest_every == 0:
            continue
        anchor = last
        if rest_every:
            anchor = max(anchor, pos // rest_every * rest_every)
        if pos - anchor < min_gap:
            continue
        out.append(pos)
        last = pos
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('regression initial anchor #1', [10, [1, 3, 6, 0, 12, 9, 7, -1], 3, 0], [3, 6]),
  ('fault site initial anchor #1', [5, [-1, 1, 7, 5, -2], 3, 0], []),
  ('partial repair boundary #1', [40, [3, 4], 3, 0], [3]),
  ('partial repair boundary #2', [22, [17, 15, -1, 24, 7, 1, -2, 18, 2], 2, 7], [2, 17]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [21, [-2, 16], 2, 5], [])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site initial anchor #1', [14, [2], 5, 0], []),
  ('regression initial anchor #1', [5, [4, 3, 1, 6, 0, 1, 3, 4], 3, 0], [3]),
  ('regression initial anchor #2', [10, [1, 3, 6, 0, 12, 9, 7, -1], 3, 0], [3, 6]),
  ('partial repair boundary #1', [22, [17, 15, -1, 24, 7, 1, -2, 18, 2], 2, 7], [2, 17]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [21, [-2, 16], 2, 5], [])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('regression initial anchor #1', [8, [3, 2, 8, 9, 7, -2, 0, 1], 2, 0], [2]),
  ('fault site initial anchor #1', [12, [2, 1, 11], 5, 0], []),
  ('partial repair boundary #1', [23, [2], 2, 0], [2]),
  ('partial repair boundary #2', [13, [4, 11, 8, 5], 5, 7], [5]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [21, [-2, 16], 2, 5], [])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('regression initial anchor #1', [13, [15, 4, 0, 6, 1, 2, 1, 14, 11], 2, 0], [2, 4, 6, 11]),
  ('fault site initial anchor #1', [20, [21, 8, 21, 2, -2, 8, 7], 5, 0], [7]),
  ('regression initial anchor #2', [5, [4, 3, 1, 6, 0, 1, 3, 4], 3, 0], [3]),
  ('partial repair boundary #1', [5, [5, 0, 4, 3, 7], 3, 0], [3]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [27, [20, 6, 10, 15, 26, -2, 12, 27, -1], 0, 0], [6, 10, 12, 15, 20])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site initial anchor #1', [11, [3, 1, 9, 8, 7, 12], 5, 0], [7]),
  ('fault site initial anchor #2', [21, [4, 11, 0, 3, 11, 4, 4, -1, 23], 5, 0], [11]),
  ('partial repair boundary #1', [33, [17, 5, -1], 5, 7], [5]),
  ('partial repair boundary #2', [24, [5], 5, 7], [5]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [34, [-1, 30, 25, 20, 1, 11, 0], 5, 4], [])]]
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(length, encounters, min_gap, rest_every):
    out = []
    last = 1
    for pos in sorted(set(encounters)):
        if pos < 1 or pos > length - 2:
            continue
        if rest_every and pos % rest_every == 0:
            continue
        anchor = last
        if rest_every:
            anchor = max(anchor, pos // rest_every * rest_every)
        if pos - anchor < min_gap:
            continue
        out.append(pos)
        last = pos
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('regression initial anchor #1', [10, [1, 3, 6, 0, 12, 9, 7, -1], 3, 0], [3, 6]),
  ('fault site initial anchor #1', [5, [-1, 1, 7, 5, -2], 3, 0], []),
  ('partial repair boundary #1', [40, [3, 4], 3, 0], [3]),
  ('partial repair boundary #2', [22, [17, 15, -1, 24, 7, 1, -2, 18, 2], 2, 7], [2, 17]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [21, [-2, 16], 2, 5], [])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site initial anchor #1', [14, [2], 5, 0], []),
  ('regression initial anchor #1', [5, [4, 3, 1, 6, 0, 1, 3, 4], 3, 0], [3]),
  ('regression initial anchor #2', [10, [1, 3, 6, 0, 12, 9, 7, -1], 3, 0], [3, 6]),
  ('partial repair boundary #1', [22, [17, 15, -1, 24, 7, 1, -2, 18, 2], 2, 7], [2, 17]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [21, [-2, 16], 2, 5], [])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('regression initial anchor #1', [8, [3, 2, 8, 9, 7, -2, 0, 1], 2, 0], [2]),
  ('fault site initial anchor #1', [12, [2, 1, 11], 5, 0], []),
  ('partial repair boundary #1', [23, [2], 2, 0], [2]),
  ('partial repair boundary #2', [13, [4, 11, 8, 5], 5, 7], [5]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [21, [-2, 16], 2, 5], [])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('regression initial anchor #1', [13, [15, 4, 0, 6, 1, 2, 1, 14, 11], 2, 0], [2, 4, 6, 11]),
  ('fault site initial anchor #1', [20, [21, 8, 21, 2, -2, 8, 7], 5, 0], [7]),
  ('regression initial anchor #2', [5, [4, 3, 1, 6, 0, 1, 3, 4], 3, 0], [3]),
  ('partial repair boundary #1', [5, [5, 0, 4, 3, 7], 3, 0], [3]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [27, [20, 6, 10, 15, 26, -2, 12, 27, -1], 0, 0], [6, 10, 12, 15, 20])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site initial anchor #1', [11, [3, 1, 9, 8, 7, 12], 5, 0], [7]),
  ('fault site initial anchor #2', [21, [4, 11, 0, 3, 11, 4, 4, -1, 23], 5, 0], [11]),
  ('partial repair boundary #1', [33, [17, 5, -1], 5, 7], [5]),
  ('partial repair boundary #2', [24, [5], 5, 7], [5]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [34, [-1, 30, 25, 20, 1, 11, 0], 5, 4], [])]]
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)

prompt:
Enemies appear right at the level entrance.

Proposed positions are deduplicated and taken ascending. A position is legal when 1 <= pos <= length-2, is not a rest checkpoint (pos % rest_every == 0 when rest_every > 0), and lies at least min_gap after the anchor: the later of the last accepted encounter (initially the start, 0) and the last checkpoint at or before pos. Returns accepted positions.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(length, encounters, min_gap, rest_every):
    out = []
    last = 0
    for pos in sorted(set(encounters)):
        if pos < 1 or pos > length - 2:
            continue
        if rest_every and pos % rest_every == 0:
            continue
        anchor = last
        if rest_every:
            anchor = max(anchor, pos // rest_every * rest_every)
        if pos - anchor <= min_gap:
            continue
        out.append(pos)
        last = pos
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site gap measure #1', [14, [4, 9, 16, 9, 16, 7, 8, 16, 0, 13], 1, 5], [4, 7, 8, 9]),
  ('fault site gap measure #2', [40, [3, 4], 3, 0], [3]),
  ('partial repair boundary #1', [21, [-2, 16], 2, 5], []),
  ('partial repair boundary #2', [34, [-1, 30, 25, 20, 1, 11, 0], 5, 4], []),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [27, [20, 6, 10, 15, 26, -2, 12, 27, -1], 0, 0], [6, 10, 12, 15, 20])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site gap measure #1', [40, [3, 4], 3, 0], [3]),
  ('fault site gap measure #2', [39, [34, 15, 35, 19, 4], 2, 4], [15, 19, 34]),
  ('partial repair boundary #1', [34, [-1, 30, 25, 20, 1, 11, 0], 5, 4], []),
  ('regression gap measure #1', [29, [13, 16], 3, 5], [13]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [27, [20, 6, 10, 15, 26, -2, 12, 27, -1], 0, 0], [6, 10, 12, 15, 20])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site gap measure #1', [10, [1, 3, 6, 0, 12, 9, 7, -1], 3, 0], [3, 6]),
  ('regression gap measure #1', [29, [13, 16], 3, 5], [13]),
  ('regression gap measure #2', [22, [17, 15, -1, 24, 7, 1, -2, 18, 2], 2, 7], [2, 17]),
  ('partial repair boundary #1', [14, [11, 0, 11, 6, 13, 15, 15, 3], 5, 7], [6]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [27, [20, 6, 10, 15, 26, -2, 12, 27, -1], 0, 0], [6, 10, 12, 15, 20])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('regression gap measure #1', [22, [17, 15, -1, 24, 7, 1, -2, 18, 2], 2, 7], [2, 17]),
  ('fault site gap measure #1', [38, [26, 15, -2, 19, 22, -1, 7, 23], 1, 0], [7, 15, 19, 22, 23, 26]),
  ('regression gap measure #2', [13, [4, 11, 8, 5], 5, 7], [5]),
  ('regression gap measure #3', [30, [32, 12, 17, 27, 6, 20], 3, 4], [27]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [40, [41, 39, 8, 9, 9, 32, 18, 41], 5, 0], [8, 18, 32])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site gap measure #1', [29, [18, 24, 20, 17, 15], 2, 0], [15, 17, 20, 24]),
  ('fault site gap measure #2', [27, [24], 3, 7], [24]),
  ('partial repair boundary #1', [37, [38, 25, 36, 9, 26, 10, 25, 2, 27, -2], 3, 5], [9]),
  ('regression gap measure #1', [33, [17, 5, -1], 5, 7], [5]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [37, [27, 33, 11, 14, 7], 0, 7], [11, 27, 33])]]
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(length, encounters, min_gap, rest_every):
    out = []
    last = 0
    for pos in sorted(set(encounters)):
        if pos < 1 or pos > length - 2:
            continue
        if rest_every and pos % rest_every == 0:
            continue
        anchor = last
        if rest_every:
            anchor = max(anchor, pos // rest_every * rest_every)
        if pos - last < min_gap:
            continue
        out.append(pos)
        last = pos
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site gap measure #1', [14, [4, 9, 16, 9, 16, 7, 8, 16, 0, 13], 1, 5], [4, 7, 8, 9]),
  ('fault site gap measure #2', [40, [3, 4], 3, 0], [3]),
  ('partial repair boundary #1', [21, [-2, 16], 2, 5], []),
  ('partial repair boundary #2', [34, [-1, 30, 25, 20, 1, 11, 0], 5, 4], []),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [27, [20, 6, 10, 15, 26, -2, 12, 27, -1], 0, 0], [6, 10, 12, 15, 20])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site gap measure #1', [40, [3, 4], 3, 0], [3]),
  ('fault site gap measure #2', [39, [34, 15, 35, 19, 4], 2, 4], [15, 19, 34]),
  ('partial repair boundary #1', [34, [-1, 30, 25, 20, 1, 11, 0], 5, 4], []),
  ('regression gap measure #1', [29, [13, 16], 3, 5], [13]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [27, [20, 6, 10, 15, 26, -2, 12, 27, -1], 0, 0], [6, 10, 12, 15, 20])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site gap measure #1', [10, [1, 3, 6, 0, 12, 9, 7, -1], 3, 0], [3, 6]),
  ('regression gap measure #1', [29, [13, 16], 3, 5], [13]),
  ('regression gap measure #2', [22, [17, 15, -1, 24, 7, 1, -2, 18, 2], 2, 7], [2, 17]),
  ('partial repair boundary #1', [14, [11, 0, 11, 6, 13, 15, 15, 3], 5, 7], [6]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [27, [20, 6, 10, 15, 26, -2, 12, 27, -1], 0, 0], [6, 10, 12, 15, 20])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('regression gap measure #1', [22, [17, 15, -1, 24, 7, 1, -2, 18, 2], 2, 7], [2, 17]),
  ('fault site gap measure #1', [38, [26, 15, -2, 19, 22, -1, 7, 23], 1, 0], [7, 15, 19, 22, 23, 26]),
  ('regression gap measure #2', [13, [4, 11, 8, 5], 5, 7], [5]),
  ('regression gap measure #3', [30, [32, 12, 17, 27, 6, 20], 3, 4], [27]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [40, [41, 39, 8, 9, 9, 32, 18, 41], 5, 0], [8, 18, 32])],
 [('checkpoint resets gap #1', [20, [2, 6, 7], 2, 5], [2, 7]),
  ('fault site gap measure #1', [29, [18, 24, 20, 17, 15], 2, 0], [15, 17, 20, 24]),
  ('fault site gap measure #2', [27, [24], 3, 7], [24]),
  ('partial repair boundary #1', [37, [38, 25, 36, 9, 26, 10, 25, 2, 27, -2], 3, 5], [9]),
  ('regression gap measure #1', [33, [17, 5, -1], 5, 7], [5]),
  ('duplicate proposals #1', [10, [3, 3, 4], 0, 0], [3, 4]),
  ('last legal tile #1', [10, [8, 9], 1, 0], [8]),
  ('control #1', [37, [27, 33, 11, 14, 7], 0, 7], [11, 27, 33])]]
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)

prompt:
Levels contain fewer encounters than designed.

Proposed positions are deduplicated and taken ascending. A position is legal when 1 <= pos <= length-2, is not a rest checkpoint (pos % rest_every == 0 when rest_every > 0), and lies at least min_gap after the anchor: the later of the last accepted encounter (initially the start, 0) and the last checkpoint at or before pos. Returns accepted positions.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(a, b):
    def door(p, q):
        px, py, pw, ph = p
        qx, qy, qw, qh = q
        if px + pw == qx:
            lo = max(py, qy)
            hi = min(py + ph, qy + qh)
            if hi - lo >= 1:
                return [px + pw, lo + (hi - lo - 1) // 2]
        if py + ph + 1 == qy:
            lo = max(px, qx)
            hi = min(px + pw, qx + qw)
            if hi > lo:
                return [(lo + hi - 1) // 2, py + ph]
        return None
    return door(a, b) or door(b, a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('fault site wall thickness #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10]),
  ('partial repair boundary #1', [[0, 7, 4, 1], [15, 3, 4, 5]], None),
  ('partial repair boundary #2', [[10, 0, 2, 6], [14, -1, 1, 5]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('control #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None),
  ('control #2', [[0, 14, 4, 5], [3, 9, 3, 1]], None)],
 [('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('fault site wall thickness #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10]),
  ('fault site wall thickness #2', [[7, 2, 4, 4], [4, 3, 3, 3]], None),
  ('partial repair boundary #1', [[1, 3, 1, 1], [9, 3, 2, 1]], None),
  ('partial repair boundary #2', [[4, 6, 3, 6], [12, 6, 3, 2]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('control #1', [[0, 14, 4, 5], [3, 9, 3, 1]], None),
  ('control #2', [[2, 9, 3, 5], [5, 15, 1, 5]], None)],
 [('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('fault site wall thickness #1', [[1, 8, 1, 2], [2, 3, 6, 6]], None),
  ('fault site wall thickness #2', [[13, 5, 1, 2], [6, 2, 6, 6]], [12, 5]),
  ('partial repair boundary #1', [[15, 1, 1, 3], [1, 3, 4, 2]], None),
  ('partial repair boundary #2', [[3, 10, 1, 3], [10, 7, 4, 6]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('control #1', [[7, 2, 3, 3], [8, 5, 2, 6]], None),
  ('control #2', [[10, 6, 5, 3], [14, 9, 2, 3]], None)],
 [('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('fault site wall thickness #1', [[11, 7, 6, 3], [7, 7, 3, 1]], [10, 7]),
  ('fault site wall thickness #2', [[8, 6, 1, 2], [9, 4, 1, 4]], None),
  ('partial repair boundary #1', [[0, 2, 6, 1], [8, 0, 1, 3]], None),
  ('partial repair boundary #2', [[9, 7, 5, 5], [16, 5, 3, 6]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('control #1', [[9, -5, 4, 4], [1, 1, 6, 2]], None),
  ('control #2', [[6, 3, 2, 2], [13, 16, 2, 4]], None)],
 [('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('fault site wall thickness #1', [[6, -4, 6, 5], [3, 0, 3, 6]], None),
  ('fault site wall thickness #2', [[10, 9, 4, 1], [15, 9, 3, 4]], [14, 9]),
  ('partial repair boundary #1', [[5, 3, 4, 2], [0, 1, 1, 3]], None),
  ('partial repair boundary #2', [[10, 2, 3, 1], [15, 0, 3, 3]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('control #1', [[14, 1, 4, 3], [10, 7, 2, 4]], None),
  ('control #2', [[1, 1, 3, 6], [3, 9, 2, 5]], None)]]
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(a, b):
    def door(p, q):
        px, py, pw, ph = p
        qx, qy, qw, qh = q
        if px + pw + 1 <= qx:
            lo = max(py, qy)
            hi = min(py + ph, qy + qh)
            if hi - lo >= 1:
                return [px + pw, lo + (hi - lo - 1) // 2]
        if py + ph + 1 == qy:
            lo = max(px, qx)
            hi = min(px + pw, qx + qw)
            if hi > lo:
                return [(lo + hi - 1) // 2, py + ph]
        return None
    return door(a, b) or door(b, a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('fault site wall thickness #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10]),
  ('partial repair boundary #1', [[0, 7, 4, 1], [15, 3, 4, 5]], None),
  ('partial repair boundary #2', [[10, 0, 2, 6], [14, -1, 1, 5]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('control #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None),
  ('control #2', [[0, 14, 4, 5], [3, 9, 3, 1]], None)],
 [('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('fault site wall thickness #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10]),
  ('fault site wall thickness #2', [[7, 2, 4, 4], [4, 3, 3, 3]], None),
  ('partial repair boundary #1', [[1, 3, 1, 1], [9, 3, 2, 1]], None),
  ('partial repair boundary #2', [[4, 6, 3, 6], [12, 6, 3, 2]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('control #1', [[0, 14, 4, 5], [3, 9, 3, 1]], None),
  ('control #2', [[2, 9, 3, 5], [5, 15, 1, 5]], None)],
 [('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('fault site wall thickness #1', [[1, 8, 1, 2], [2, 3, 6, 6]], None),
  ('fault site wall thickness #2', [[13, 5, 1, 2], [6, 2, 6, 6]], [12, 5]),
  ('partial repair boundary #1', [[15, 1, 1, 3], [1, 3, 4, 2]], None),
  ('partial repair boundary #2', [[3, 10, 1, 3], [10, 7, 4, 6]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('control #1', [[7, 2, 3, 3], [8, 5, 2, 6]], None),
  ('control #2', [[10, 6, 5, 3], [14, 9, 2, 3]], None)],
 [('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('fault site wall thickness #1', [[11, 7, 6, 3], [7, 7, 3, 1]], [10, 7]),
  ('fault site wall thickness #2', [[8, 6, 1, 2], [9, 4, 1, 4]], None),
  ('partial repair boundary #1', [[0, 2, 6, 1], [8, 0, 1, 3]], None),
  ('partial repair boundary #2', [[9, 7, 5, 5], [16, 5, 3, 6]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('control #1', [[9, -5, 4, 4], [1, 1, 6, 2]], None),
  ('control #2', [[6, 3, 2, 2], [13, 16, 2, 4]], None)],
 [('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('fault site wall thickness #1', [[6, -4, 6, 5], [3, 0, 3, 6]], None),
  ('fault site wall thickness #2', [[10, 9, 4, 1], [15, 9, 3, 4]], [14, 9]),
  ('partial repair boundary #1', [[5, 3, 4, 2], [0, 1, 1, 3]], None),
  ('partial repair boundary #2', [[10, 2, 3, 1], [15, 0, 3, 3]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('control #1', [[14, 1, 4, 3], [10, 7, 2, 4]], None),
  ('control #2', [[1, 1, 3, 6], [3, 9, 2, 5]], None)]]
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)

prompt:
Doors are placed between touching rooms and inside the neighbour.

Rooms [x, y, w, h] are interiors separated by one wall tile when x_a + w_a + 1 == x_b (b right of a) or y_a + h_a + 1 == y_b (b below a), checked in both room orders. The door sits in the wall at the middle of the shared span [lo, hi) (lower middle for even spans): column x_a+w_a for side-by-side rooms, row y_a+h_a for stacked rooms. Returns [x, y] or None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(a, b):
    def door(p, q):
        px, py, pw, ph = p
        qx, qy, qw, qh = q
        if px + pw + 1 == qx:
            lo = max(py, qy)
            hi = max(py + ph, qy + qh)
            if hi - lo >= 1:
                return [px + pw, lo + (hi - lo - 1) // 2]
        if py + ph + 1 == qy:
            lo = max(px, qx)
            hi = min(px + pw, qx + qw)
            if hi > lo:
                return [(lo + hi - 1) // 2, py + ph]
        return None
    return door(a, b) or door(b, a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('regression shared span end #1', [[13, 5, 1, 2], [6, 2, 6, 6]], [12, 5]),
  ('fault site shared span end #1', [[11, 7, 6, 3], [7, 7, 3, 1]], [10, 7]),
  ('regression shared span end #2', [[9, 4, 3, 2], [13, 6, 1, 5]], None),
  ('regression shared span end #3', [[8, 9, 3, 6], [5, 4, 2, 5]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None)],
 [('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('fault site shared span end #1', [[11, 7, 6, 3], [7, 7, 3, 1]], [10, 7]),
  ('fault site shared span end #2', [[7, 0, 5, 3], [2, 4, 4, 3]], None),
  ('regression shared span end #1', [[8, 9, 3, 6], [5, 4, 2, 5]], None),
  ('regression shared span end #2', [[10, -3, 6, 3], [4, 0, 5, 6]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None)],
 [('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('fault site shared span end #1', [[7, 1, 1, 5], [9, 7, 2, 4]], None),
  ('fault site shared span end #2', [[2, 7, 4, 4], [7, 5, 4, 1]], None),
  ('regression shared span end #1', [[11, 6, 3, 5], [4, 9, 6, 6]], [10, 9]),
  ('regression shared span end #2', [[11, 14, 1, 4], [6, 9, 4, 5]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None)],
 [('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('fault site shared span end #1', [[3, 11, 4, 2], [8, 8, 1, 2]], None),
  ('fault site shared span end #2', [[10, 9, 4, 1], [15, 9, 3, 4]], [14, 9]),
  ('regression shared span end #1', [[8, 1, 5, 5], [4, 6, 3, 1]], None),
  ('regression shared span end #2', [[10, 9, 4, 3], [7, 7, 2, 2]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('fault site shared span end #1', [[3, 5, 4, 5], [8, 0, 3, 2]], None),
  ('regression shared span end #1', [[9, 4, 3, 2], [13, 6, 1, 5]], None),
  ('regression shared span end #2', [[6, 7, 6, 6], [0, 13, 5, 3]], None),
  ('regression shared span end #3', [[10, 6, 6, 3], [5, 9, 4, 2]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[0, 14, 4, 5], [3, 9, 3, 1]], None)]]
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(a, b):
    def door(p, q):
        px, py, pw, ph = p
        qx, qy, qw, qh = q
        if px + pw + 1 == qx:
            lo = max(py, qy)
            hi = min(py + ph, qy + qh) + 1
            if hi - lo >= 1:
                return [px + pw, lo + (hi - lo - 1) // 2]
        if py + ph + 1 == qy:
            lo = max(px, qx)
            hi = min(px + pw, qx + qw)
            if hi > lo:
                return [(lo + hi - 1) // 2, py + ph]
        return None
    return door(a, b) or door(b, a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('regression shared span end #1', [[13, 5, 1, 2], [6, 2, 6, 6]], [12, 5]),
  ('fault site shared span end #1', [[11, 7, 6, 3], [7, 7, 3, 1]], [10, 7]),
  ('regression shared span end #2', [[9, 4, 3, 2], [13, 6, 1, 5]], None),
  ('regression shared span end #3', [[8, 9, 3, 6], [5, 4, 2, 5]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None)],
 [('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('fault site shared span end #1', [[11, 7, 6, 3], [7, 7, 3, 1]], [10, 7]),
  ('fault site shared span end #2', [[7, 0, 5, 3], [2, 4, 4, 3]], None),
  ('regression shared span end #1', [[8, 9, 3, 6], [5, 4, 2, 5]], None),
  ('regression shared span end #2', [[10, -3, 6, 3], [4, 0, 5, 6]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None)],
 [('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('fault site shared span end #1', [[7, 1, 1, 5], [9, 7, 2, 4]], None),
  ('fault site shared span end #2', [[2, 7, 4, 4], [7, 5, 4, 1]], None),
  ('regression shared span end #1', [[11, 6, 3, 5], [4, 9, 6, 6]], [10, 9]),
  ('regression shared span end #2', [[11, 14, 1, 4], [6, 9, 4, 5]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None)],
 [('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('fault site shared span end #1', [[3, 11, 4, 2], [8, 8, 1, 2]], None),
  ('fault site shared span end #2', [[10, 9, 4, 1], [15, 9, 3, 4]], [14, 9]),
  ('regression shared span end #1', [[8, 1, 5, 5], [4, 6, 3, 1]], None),
  ('regression shared span end #2', [[10, 9, 4, 3], [7, 7, 2, 2]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('fault site shared span end #1', [[3, 5, 4, 5], [8, 0, 3, 2]], None),
  ('regression shared span end #1', [[9, 4, 3, 2], [13, 6, 1, 5]], None),
  ('regression shared span end #2', [[6, 7, 6, 6], [0, 13, 5, 3]], None),
  ('regression shared span end #3', [[10, 6, 6, 3], [5, 9, 4, 2]], None),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[0, 14, 4, 5], [3, 9, 3, 1]], None)]]
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)

prompt:
Doors open into solid rock beside the smaller room.

Rooms [x, y, w, h] are interiors separated by one wall tile when x_a + w_a + 1 == x_b (b right of a) or y_a + h_a + 1 == y_b (b below a), checked in both room orders. The door sits in the wall at the middle of the shared span [lo, hi) (lower middle for even spans): column x_a+w_a for side-by-side rooms, row y_a+h_a for stacked rooms. Returns [x, y] or None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(a, b):
    def door(p, q):
        px, py, pw, ph = p
        qx, qy, qw, qh = q
        if px + pw + 1 == qx:
            lo = max(py, qy)
            hi = min(py + ph, qy + qh)
            if hi - lo >= 0:
                return [px + pw, lo + (hi - lo - 1) // 2]
        if py + ph + 1 == qy:
            lo = max(px, qx)
            hi = min(px + pw, qx + qw)
            if hi > lo:
                return [(lo + hi - 1) // 2, py + ph]
        return None
    return door(a, b) or door(b, a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('fault site span requirement #1', [[9, 4, 3, 2], [13, 6, 1, 5]], None),
  ('fault site span requirement #2', [[8, 9, 3, 6], [5, 4, 2, 5]], None),
  ('partial repair boundary #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10]),
  ('partial repair boundary #2', [[11, 7, 6, 3], [7, 7, 3, 1]], [10, 7]),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None)],
 [('fault site span requirement #1', [[10, -3, 6, 3], [4, 0, 5, 6]], None),
  ('fault site span requirement #2', [[11, 14, 1, 4], [6, 9, 4, 5]], None),
  ('partial repair boundary #1', [[10, 9, 4, 1], [15, 9, 3, 4]], [14, 9]),
  ('partial repair boundary #2', [[0, 9, 1, 5], [2, 9, 3, 1]], [1, 9]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('control #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None),
  ('control #2', [[0, 14, 4, 5], [3, 9, 3, 1]], None)],
 [('fault site span requirement #1', [[8, 1, 5, 5], [4, 6, 3, 1]], None),
  ('fault site span requirement #2', [[10, 9, 4, 3], [7, 7, 2, 2]], None),
  ('partial repair boundary #1', [[6, 6, 4, 1], [11, 4, 6, 4]], [10, 6]),
  ('partial repair boundary #2', [[8, 5, 4, 2], [13, 6, 1, 3]], [12, 6]),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[0, 14, 4, 5], [3, 9, 3, 1]], None),
  ('control #2', [[7, 2, 4, 4], [4, 3, 3, 3]], None)],
 [('fault site span requirement #1', [[6, 7, 6, 6], [0, 13, 5, 3]], None),
  ('fault site span requirement #2', [[10, 6, 6, 3], [5, 9, 4, 2]], None),
  ('partial repair boundary #1', [[7, 7, 6, 1], [14, 3, 5, 5]], [13, 7]),
  ('partial repair boundary #2', [[7, 13, 1, 6], [4, 9, 2, 5]], [6, 13]),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('control #1', [[2, 9, 3, 5], [5, 15, 1, 5]], None),
  ('control #2', [[7, 2, 3, 3], [8, 5, 2, 6]], None)],
 [('fault site span requirement #1', [[4, 7, 3, 6], [1, 6, 2, 1]], None),
  ('fault site span requirement #2', [[12, 13, 3, 1], [6, 9, 5, 4]], None),
  ('partial repair boundary #1', [[7, 4, 4, 3], [2, 5, 4, 1]], [6, 5]),
  ('partial repair boundary #2', [[15, 9, 6, 6], [10, 5, 4, 5]], [14, 9]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('control #1', [[0, 7, 4, 1], [15, 3, 4, 5]], None),
  ('control #2', [[10, 0, 2, 6], [14, -1, 1, 5]], None)]]
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(a, b):
    def door(p, q):
        px, py, pw, ph = p
        qx, qy, qw, qh = q
        if px + pw + 1 == qx:
            lo = max(py, qy)
            hi = min(py + ph, qy + qh)
            if hi > lo + 1:
                return [px + pw, lo + (hi - lo - 1) // 2]
        if py + ph + 1 == qy:
            lo = max(px, qx)
            hi = min(px + pw, qx + qw)
            if hi > lo:
                return [(lo + hi - 1) // 2, py + ph]
        return None
    return door(a, b) or door(b, a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('fault site span requirement #1', [[9, 4, 3, 2], [13, 6, 1, 5]], None),
  ('fault site span requirement #2', [[8, 9, 3, 6], [5, 4, 2, 5]], None),
  ('partial repair boundary #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10]),
  ('partial repair boundary #2', [[11, 7, 6, 3], [7, 7, 3, 1]], [10, 7]),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None)],
 [('fault site span requirement #1', [[10, -3, 6, 3], [4, 0, 5, 6]], None),
  ('fault site span requirement #2', [[11, 14, 1, 4], [6, 9, 4, 5]], None),
  ('partial repair boundary #1', [[10, 9, 4, 1], [15, 9, 3, 4]], [14, 9]),
  ('partial repair boundary #2', [[0, 9, 1, 5], [2, 9, 3, 1]], [1, 9]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('control #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None),
  ('control #2', [[0, 14, 4, 5], [3, 9, 3, 1]], None)],
 [('fault site span requirement #1', [[8, 1, 5, 5], [4, 6, 3, 1]], None),
  ('fault site span requirement #2', [[10, 9, 4, 3], [7, 7, 2, 2]], None),
  ('partial repair boundary #1', [[6, 6, 4, 1], [11, 4, 6, 4]], [10, 6]),
  ('partial repair boundary #2', [[8, 5, 4, 2], [13, 6, 1, 3]], [12, 6]),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[0, 14, 4, 5], [3, 9, 3, 1]], None),
  ('control #2', [[7, 2, 4, 4], [4, 3, 3, 3]], None)],
 [('fault site span requirement #1', [[6, 7, 6, 6], [0, 13, 5, 3]], None),
  ('fault site span requirement #2', [[10, 6, 6, 3], [5, 9, 4, 2]], None),
  ('partial repair boundary #1', [[7, 7, 6, 1], [14, 3, 5, 5]], [13, 7]),
  ('partial repair boundary #2', [[7, 13, 1, 6], [4, 9, 2, 5]], [6, 13]),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('control #1', [[2, 9, 3, 5], [5, 15, 1, 5]], None),
  ('control #2', [[7, 2, 3, 3], [8, 5, 2, 6]], None)],
 [('fault site span requirement #1', [[4, 7, 3, 6], [1, 6, 2, 1]], None),
  ('fault site span requirement #2', [[12, 13, 3, 1], [6, 9, 5, 4]], None),
  ('partial repair boundary #1', [[7, 4, 4, 3], [2, 5, 4, 1]], [6, 5]),
  ('partial repair boundary #2', [[15, 9, 6, 6], [10, 5, 4, 5]], [14, 9]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('control #1', [[0, 7, 4, 1], [15, 3, 4, 5]], None),
  ('control #2', [[10, 0, 2, 6], [14, -1, 1, 5]], None)]]
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)

prompt:
Rooms that only meet at a corner get a door.

Rooms [x, y, w, h] are interiors separated by one wall tile when x_a + w_a + 1 == x_b (b right of a) or y_a + h_a + 1 == y_b (b below a), checked in both room orders. The door sits in the wall at the middle of the shared span [lo, hi) (lower middle for even spans): column x_a+w_a for side-by-side rooms, row y_a+h_a for stacked rooms. Returns [x, y] or None.

split: open-access


prompt:
Side doors are off-centre toward the bottom.

Rooms [x, y, w, h] are interiors separated by one wall tile when x_a + w_a + 1 == x_b (b right of a) or y_a + h_a + 1 == y_b (b below a), checked in both room orders. The door sits in the wall at the middle of the shared span [lo, hi) (lower middle for even spans): column x_a+w_a for side-by-side rooms, row y_a+h_a for stacked rooms. Returns [x, y] or None.

split: open-access


prompt:
Side doors are drawn one tile into the right room.

Rooms [x, y, w, h] are interiors separated by one wall tile when x_a + w_a + 1 == x_b (b right of a) or y_a + h_a + 1 == y_b (b below a), checked in both room orders. The door sits in the wall at the middle of the shared span [lo, hi) (lower middle for even spans): column x_a+w_a for side-by-side rooms, row y_a+h_a for stacked rooms. Returns [x, y] or None.

split: open-access


prompt:
Connectivity depends on the order rooms were generated.

Rooms [x, y, w, h] are interiors separated by one wall tile when x_a + w_a + 1 == x_b (b right of a) or y_a + h_a + 1 == y_b (b below a), checked in both room orders. The door sits in the wall at the middle of the shared span [lo, hi) (lower middle for even spans): column x_a+w_a for side-by-side rooms, row y_a+h_a for stacked rooms. Returns [x, y] or None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(a, b):
    def door(p, q):
        px, py, pw, ph = p
        qx, qy, qw, qh = q
        if px + pw + 1 == qx:
            lo = max(py, qy)
            hi = min(py + ph, qy + qh)
            if hi - lo >= 1:
                return [px + pw, lo + (hi - lo - 1) // 2]
        if py + ph + 1 == qx:
            lo = max(px, qx)
            hi = min(px + pw, qx + qw)
            if hi > lo:
                return [(lo + hi - 1) // 2, py + ph]
        return None
    return door(a, b) or door(b, a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('fault site stacked axis #1', [[10, 3, 5, 4], [8, 0, 3, 1]], None),
  ('fault site stacked axis #2', [[2, 2, 6, 1], [4, 5, 3, 5]], None),
  ('partial repair boundary #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None),
  ('partial repair boundary #2', [[7, 2, 3, 3], [8, 5, 2, 6]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('fault site stacked axis #1', [[2, 2, 6, 1], [4, 5, 3, 5]], None),
  ('regression stacked axis #1', [[7, 4, 5, 3], [10, 8, 1, 4]], [10, 7]),
  ('partial repair boundary #1', [[7, 2, 3, 3], [8, 5, 2, 6]], None),
  ('partial repair boundary #2', [[10, 6, 5, 3], [14, 9, 2, 3]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[10, 11, 6, 4], [7, 7, 6, 3]], [11, 10]),
  ('regression stacked axis #2', [[7, 11, 4, 3], [7, 4, 5, 6]], [8, 10]),
  ('partial repair boundary #1', [[5, 5, 2, 5], [5, 1, 6, 3]], [5, 4]),
  ('partial repair boundary #2', [[3, 9, 6, 5], [2, 4, 4, 5]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[7, 6, 5, 5], [3, 0, 6, 5]], [7, 5]),
  ('regression stacked axis #2', [[4, 13, 5, 2], [3, 9, 2, 3]], [4, 12]),
  ('partial repair boundary #1', [[9, 6, 5, 2], [9, 9, 3, 6]], [10, 8]),
  ('regression stacked axis #3', [[7, 4, 5, 3], [10, 8, 1, 4]], [10, 7]),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[0, 14, 4, 5], [3, 9, 3, 1]], None)],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[9, 5, 4, 3], [9, 3, 5, 1]], [10, 4]),
  ('regression stacked axis #2', [[9, 6, 4, 6], [8, 13, 6, 4]], [10, 12]),
  ('regression stacked axis #3', [[10, 11, 6, 4], [7, 7, 6, 3]], [11, 10]),
  ('regression stacked axis #4', [[7, 11, 4, 3], [7, 4, 5, 6]], [8, 10]),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[7, 2, 4, 4], [4, 3, 3, 3]], None)]]
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(a, b):
    def door(p, q):
        px, py, pw, ph = p
        qx, qy, qw, qh = q
        if px + pw + 1 == qx:
            lo = max(py, qy)
            hi = min(py + ph, qy + qh)
            if hi - lo >= 1:
                return [px + pw, lo + (hi - lo - 1) // 2]
        if py + ph == qy:
            lo = max(px, qx)
            hi = min(px + pw, qx + qw)
            if hi > lo:
                return [(lo + hi - 1) // 2, py + ph]
        return None
    return door(a, b) or door(b, a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('fault site stacked axis #1', [[10, 3, 5, 4], [8, 0, 3, 1]], None),
  ('fault site stacked axis #2', [[2, 2, 6, 1], [4, 5, 3, 5]], None),
  ('partial repair boundary #1', [[6, 10, 4, 6], [5, 7, 4, 3]], None),
  ('partial repair boundary #2', [[7, 2, 3, 3], [8, 5, 2, 6]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('fault site stacked axis #1', [[2, 2, 6, 1], [4, 5, 3, 5]], None),
  ('regression stacked axis #1', [[7, 4, 5, 3], [10, 8, 1, 4]], [10, 7]),
  ('partial repair boundary #1', [[7, 2, 3, 3], [8, 5, 2, 6]], None),
  ('partial repair boundary #2', [[10, 6, 5, 3], [14, 9, 2, 3]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[10, 11, 6, 4], [7, 7, 6, 3]], [11, 10]),
  ('regression stacked axis #2', [[7, 11, 4, 3], [7, 4, 5, 6]], [8, 10]),
  ('partial repair boundary #1', [[5, 5, 2, 5], [5, 1, 6, 3]], [5, 4]),
  ('partial repair boundary #2', [[3, 9, 6, 5], [2, 4, 4, 5]], None),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[3, 10, 2, 1], [6, 6, 6, 5]], [5, 10])],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[7, 6, 5, 5], [3, 0, 6, 5]], [7, 5]),
  ('regression stacked axis #2', [[4, 13, 5, 2], [3, 9, 2, 3]], [4, 12]),
  ('partial repair boundary #1', [[9, 6, 5, 2], [9, 9, 3, 6]], [10, 8]),
  ('regression stacked axis #3', [[7, 4, 5, 3], [10, 8, 1, 4]], [10, 7]),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[0, 14, 4, 5], [3, 9, 3, 1]], None)],
 [('stacked reversed order #1', [[2, 5, 3, 2], [1, 0, 4, 4]], [3, 4]),
  ('regression stacked axis #1', [[9, 5, 4, 3], [9, 3, 5, 1]], [10, 4]),
  ('regression stacked axis #2', [[9, 6, 4, 6], [8, 13, 6, 4]], [10, 12]),
  ('regression stacked axis #3', [[10, 11, 6, 4], [7, 7, 6, 3]], [11, 10]),
  ('regression stacked axis #4', [[7, 11, 4, 3], [7, 4, 5, 6]], [8, 10]),
  ('side by side #1', [[0, 0, 3, 4], [4, 1, 2, 5]], [3, 2]),
  ('rooms touching without wall #1', [[0, 0, 3, 3], [3, 0, 3, 3]], None),
  ('control #1', [[7, 2, 4, 4], [4, 3, 3, 3]], None)]]
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)

prompt:
Vertically stacked rooms are only connected by coincidence.

Rooms [x, y, w, h] are interiors separated by one wall tile when x_a + w_a + 1 == x_b (b right of a) or y_a + h_a + 1 == y_b (b below a), checked in both room orders. The door sits in the wall at the middle of the shared span [lo, hi) (lower middle for even spans): column x_a+w_a for side-by-side rooms, row y_a+h_a for stacked rooms. Returns [x, y] or None.

split: open-access


prompt:
Stair placement differs from the documented row-major rule.

Scan floor_a row by row (y), then column (x); choose the first cell where floor_a[y][x] == '.', the cell exists on floor_b and is '.' there, and the Manhattan distance to entrance [x, y] is at least min_dist. Returns [x, y] or None.

split: open-access


prompt:
The down stair leads onto a water tile.

Scan floor_a row by row (y), then column (x); choose the first cell where floor_a[y][x] == '.', the cell exists on floor_b and is '.' there, and the Manhattan distance to entrance [x, y] is at least min_dist. Returns [x, y] or None.

split: open-access


prompt:
Stairs spawn next to the entrance on non-diagonal layouts.

Scan floor_a row by row (y), then column (x); choose the first cell where floor_a[y][x] == '.', the cell exists on floor_b and is '.' there, and the Manhattan distance to entrance [x, y] is at least min_dist. Returns [x, y] or None.

split: open-access


prompt:
Small floors fail to place stairs.

Scan floor_a row by row (y), then column (x); choose the first cell where floor_a[y][x] == '.', the cell exists on floor_b and is '.' there, and the Manhattan distance to entrance [x, y] is at least min_dist. Returns [x, y] or None.

split: open-access


prompt:
A stiff spring that should orbit with bounded energy gains amplitude every frame.

solve(x0, v0, k, m, c, dt, steps): damped spring a=(-k*x-c*v)/m integrated with semi-implicit Euler (velocity first, then position with the new velocity). Each frame of length dt is split into ceil(dt/0.05) equal substeps (at least one). Return [x, v] rounded to 6 decimals after steps frames.

split: open-access


prompt:
Displaced masses accelerate outward and the state grows exponentially.

solve(x0, v0, k, m, c, dt, steps): damped spring a=(-k*x-c*v)/m integrated with semi-implicit Euler (velocity first, then position with the new velocity). Each frame of length dt is split into ceil(dt/0.05) equal substeps (at least one). Return [x, v] rounded to 6 decimals after steps frames.

split: open-access


prompt:
Heavy bodies are over-damped and light ones under-damped relative to the contract.

solve(x0, v0, k, m, c, dt, steps): damped spring a=(-k*x-c*v)/m integrated with semi-implicit Euler (velocity first, then position with the new velocity). Each frame of length dt is split into ceil(dt/0.05) equal substeps (at least one). Return [x, v] rounded to 6 decimals after steps frames.

split: open-access


prompt:
Frames slightly longer than the 0.05 limit run one oversized substep and lose stability margin.

solve(x0, v0, k, m, c, dt, steps): damped spring a=(-k*x-c*v)/m integrated with semi-implicit Euler (velocity first, then position with the new velocity). Each frame of length dt is split into ceil(dt/0.05) equal substeps (at least one). Return [x, v] rounded to 6 decimals after steps frames.

split: open-access


prompt:
Frames split into several substeps advance simulated time by a multiple of dt.

solve(x0, v0, k, m, c, dt, steps): damped spring a=(-k*x-c*v)/m integrated with semi-implicit Euler (velocity first, then position with the new velocity). Each frame of length dt is split into ceil(dt/0.05) equal substeps (at least one). Return [x, v] rounded to 6 decimals after steps frames.

split: open-access


prompt:
Even zero requested frames move the body.

solve(x0, v0, k, m, c, dt, steps): damped spring a=(-k*x-c*v)/m integrated with semi-implicit Euler (velocity first, then position with the new velocity). Each frame of length dt is split into ceil(dt/0.05) equal substeps (at least one). Return [x, v] rounded to 6 decimals after steps frames.

split: open-access


prompt:
Pendulum energy drifts steadily instead of oscillating around a constant.

solve(theta_deg, omega, g, L, dt, steps): planar pendulum theta''=-(g/L)*sin(theta), initial angle in degrees, omega in rad/s, integrated with velocity Verlet carrying the acceleration between steps. Return [angle in degrees, omega, energy per unit mass 0.5*L^2*omega^2 + g*L*(1-cos theta)], rounded to 6.

split: open-access


prompt:
Swing amplitude is systematically wrong at larger time steps.

solve(theta_deg, omega, g, L, dt, steps): planar pendulum theta''=-(g/L)*sin(theta), initial angle in degrees, omega in rad/s, integrated with velocity Verlet carrying the acceleration between steps. Return [angle in degrees, omega, energy per unit mass 0.5*L^2*omega^2 + g*L*(1-cos theta)], rounded to 6.

split: open-access


prompt:
After the first step the integrator keeps using the initial-angle acceleration.

solve(theta_deg, omega, g, L, dt, steps): planar pendulum theta''=-(g/L)*sin(theta), initial angle in degrees, omega in rad/s, integrated with velocity Verlet carrying the acceleration between steps. Return [angle in degrees, omega, energy per unit mass 0.5*L^2*omega^2 + g*L*(1-cos theta)], rounded to 6.

split: open-access


prompt:
A 30 degree release swings as if released from 30 radians.

solve(theta_deg, omega, g, L, dt, steps): planar pendulum theta''=-(g/L)*sin(theta), initial angle in degrees, omega in rad/s, integrated with velocity Verlet carrying the acceleration between steps. Return [angle in degrees, omega, energy per unit mass 0.5*L^2*omega^2 + g*L*(1-cos theta)], rounded to 6.

split: open-access


prompt:
Large releases oscillate with the harmonic period instead of the slower nonlinear period.

solve(theta_deg, omega, g, L, dt, steps): planar pendulum theta''=-(g/L)*sin(theta), initial angle in degrees, omega in rad/s, integrated with velocity Verlet carrying the acceleration between steps. Return [angle in degrees, omega, energy per unit mass 0.5*L^2*omega^2 + g*L*(1-cos theta)], rounded to 6.

split: open-access


prompt:
The reported energy is offset and has the wrong sign convention at rest.

solve(theta_deg, omega, g, L, dt, steps): planar pendulum theta''=-(g/L)*sin(theta), initial angle in degrees, omega in rad/s, integrated with velocity Verlet carrying the acceleration between steps. Return [angle in degrees, omega, energy per unit mass 0.5*L^2*omega^2 + g*L*(1-cos theta)], rounded to 6.

split: open-access


prompt:
Energy diagnostics disagree with the integrated state for any rod length other than one.

solve(theta_deg, omega, g, L, dt, steps): planar pendulum theta''=-(g/L)*sin(theta), initial angle in degrees, omega in rad/s, integrated with velocity Verlet carrying the acceleration between steps. Return [angle in degrees, omega, energy per unit mass 0.5*L^2*omega^2 + g*L*(1-cos theta)], rounded to 6.

split: open-access


prompt:
Heavy bodies are classified with the eigenvalues of a unit-mass system.

solve(k, m, c, dt): classify explicit Euler on x'=v, v'=(-k*x-c*v)/m. Eigenvalues are the roots of s^2+(c/m)s+k/m; amplification is max |1+dt*lambda|. Return ["marginal" if |amp-1|<=1e-9, else "stable" if amp<1, else "unstable", amp rounded to 6].

split: open-access


prompt:
Overdamped systems whose fast root leaves the unit disc are reported stable.

solve(k, m, c, dt): classify explicit Euler on x'=v, v'=(-k*x-c*v)/m. Eigenvalues are the roots of s^2+(c/m)s+k/m; amplification is max |1+dt*lambda|. Return ["marginal" if |amp-1|<=1e-9, else "stable" if amp<1, else "unstable", amp rounded to 6].

split: open-access


prompt:
Oscillatory systems report too much amplification and are flagged unstable early.

solve(k, m, c, dt): classify explicit Euler on x'=v, v'=(-k*x-c*v)/m. Eigenvalues are the roots of s^2+(c/m)s+k/m; amplification is max |1+dt*lambda|. Return ["marginal" if |amp-1|<=1e-9, else "stable" if amp<1, else "unstable", amp rounded to 6].

split: open-access


prompt:
Undamped oscillators are called stable although explicit Euler always gains energy on them.

solve(k, m, c, dt): classify explicit Euler on x'=v, v'=(-k*x-c*v)/m. Eigenvalues are the roots of s^2+(c/m)s+k/m; amplification is max |1+dt*lambda|. Return ["marginal" if |amp-1|<=1e-9, else "stable" if amp<1, else "unstable", amp rounded to 6].

split: open-access


prompt:
A free damped particle (zero stiffness) is reported stable although its drift mode never decays.

solve(k, m, c, dt): classify explicit Euler on x'=v, v'=(-k*x-c*v)/m. Eigenvalues are the roots of s^2+(c/m)s+k/m; amplification is max |1+dt*lambda|. Return ["marginal" if |amp-1|<=1e-9, else "stable" if amp<1, else "unstable", amp rounded to 6].

split: open-access


prompt:
Heavy bodies appear strongly damped and light ones barely damped.

solve(k, m, c, dt): classify explicit Euler on x'=v, v'=(-k*x-c*v)/m. Eigenvalues are the roots of s^2+(c/m)s+k/m; amplification is max |1+dt*lambda|. Return ["marginal" if |amp-1|<=1e-9, else "stable" if amp<1, else "unstable", amp rounded to 6].

split: open-access


prompt:
Stiff tethers to the world explode because they never shrink the substep.

solve(springs, safety, dt_frame, max_sub): springs are [k, inv_mass_a, inv_mass_b] (inverse mass 0 = static). A spring with k>0 and nonzero summed inverse mass w limits the substep to safety*2/sqrt(k*w). n=ceil(dt_frame/h_min) clamped to [1,max_sub]; return [n, dt_frame/n rounded to 6, whether n had to be clamped down]. No limiting spring gives [1, dt_frame, False].

split: open-access


prompt:
Two light bodies connected by a stiff spring get a substep that is too long.

solve(springs, safety, dt_frame, max_sub): springs are [k, inv_mass_a, inv_mass_b] (inverse mass 0 = static). A spring with k>0 and nonzero summed inverse mass w limits the substep to safety*2/sqrt(k*w). n=ceil(dt_frame/h_min) clamped to [1,max_sub]; return [n, dt_frame/n rounded to 6, whether n had to be clamped down]. No limiting spring gives [1, dt_frame, False].

split: open-access


prompt:
Stiffness changes the substep quadratically wrong, overshooting or wasting substeps.

solve(springs, safety, dt_frame, max_sub): springs are [k, inv_mass_a, inv_mass_b] (inverse mass 0 = static). A spring with k>0 and nonzero summed inverse mass w limits the substep to safety*2/sqrt(k*w). n=ceil(dt_frame/h_min) clamped to [1,max_sub]; return [n, dt_frame/n rounded to 6, whether n had to be clamped down]. No limiting spring gives [1, dt_frame, False].

split: open-access


prompt:
The solver runs twice as many substeps as the contract bound requires.

solve(springs, safety, dt_frame, max_sub): springs are [k, inv_mass_a, inv_mass_b] (inverse mass 0 = static). A spring with k>0 and nonzero summed inverse mass w limits the substep to safety*2/sqrt(k*w). n=ceil(dt_frame/h_min) clamped to [1,max_sub]; return [n, dt_frame/n rounded to 6, whether n had to be clamped down]. No limiting spring gives [1, dt_frame, False].

split: open-access


prompt:
Frames needing 2.3 critical steps run only two, each above the stability limit.

solve(springs, safety, dt_frame, max_sub): springs are [k, inv_mass_a, inv_mass_b] (inverse mass 0 = static). A spring with k>0 and nonzero summed inverse mass w limits the substep to safety*2/sqrt(k*w). n=ceil(dt_frame/h_min) clamped to [1,max_sub]; return [n, dt_frame/n rounded to 6, whether n had to be clamped down]. No limiting spring gives [1, dt_frame, False].

split: open-access


prompt:
The caller is never told the frame ran above the stability limit.

solve(springs, safety, dt_frame, max_sub): springs are [k, inv_mass_a, inv_mass_b] (inverse mass 0 = static). A spring with k>0 and nonzero summed inverse mass w limits the substep to safety*2/sqrt(k*w). n=ceil(dt_frame/h_min) clamped to [1,max_sub]; return [n, dt_frame/n rounded to 6, whether n had to be clamped down]. No limiting spring gives [1, dt_frame, False].

split: open-access


prompt:
A single stiff spring in a soft network is integrated with the soft spring step.

solve(springs, safety, dt_frame, max_sub): springs are [k, inv_mass_a, inv_mass_b] (inverse mass 0 = static). A spring with k>0 and nonzero summed inverse mass w limits the substep to safety*2/sqrt(k*w). n=ceil(dt_frame/h_min) clamped to [1,max_sub]; return [n, dt_frame/n rounded to 6, whether n had to be clamped down]. No limiting spring gives [1, dt_frame, False].

split: open-access


prompt:
A frame exactly one fixed step long runs no physics step and the renderer lags a frame.

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].

split: open-access


prompt:
A debugger pause produces a burst of dropped time and a huge catch-up.

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].

split: open-access


prompt:
After a long frame the accumulator keeps backlog and every later frame runs at the budget limit.

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].

split: open-access


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

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].

split: open-access


prompt:
Interpolation weights are tiny and rendering visibly snaps between states.

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].

split: open-access


prompt:
Telemetry reports tiny losses while the simulation actually discarded whole steps.

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].

split: open-access


prompt:
Driven oscillators lag the drive phase and resonance peaks shift.

solve(x0, v0, k, c, F, wf, dt, steps): unit mass x''=-k*x-c*v+F*cos(wf*t) with wf in rad/s, t starting at 0, integrated with classical RK4. Return [x, v, t] rounded to 6.

split: open-access


prompt:
The method degrades to second order and energy error grows with dt^2.

solve(x0, v0, k, c, F, wf, dt, steps): unit mass x''=-k*x-c*v+F*cos(wf*t) with wf in rad/s, t starting at 0, integrated with classical RK4. Return [x, v, t] rounded to 6.

split: open-access


prompt:
End-of-step slope is evaluated at the midpoint and trajectories drift.

solve(x0, v0, k, c, F, wf, dt, steps): unit mass x''=-k*x-c*v+F*cos(wf*t) with wf in rad/s, t starting at 0, integrated with classical RK4. Return [x, v, t] rounded to 6.

split: open-access


prompt:
The combined step is only first order accurate.

solve(x0, v0, k, c, F, wf, dt, steps): unit mass x''=-k*x-c*v+F*cos(wf*t) with wf in rad/s, t starting at 0, integrated with classical RK4. Return [x, v, t] rounded to 6.

split: open-access


prompt:
The drive force is frozen at cos(0) and forced response is wrong.

solve(x0, v0, k, c, F, wf, dt, steps): unit mass x''=-k*x-c*v+F*cos(wf*t) with wf in rad/s, t starting at 0, integrated with classical RK4. Return [x, v, t] rounded to 6.

split: open-access


prompt:
A damped, driven system grows without bound.

solve(x0, v0, k, c, F, wf, dt, steps): unit mass x''=-k*x-c*v+F*cos(wf*t) with wf in rad/s, t starting at 0, integrated with classical RK4. Return [x, v, t] rounded to 6.

split: open-access


prompt:
The forcing oscillates 2*pi times too fast.

solve(x0, v0, k, c, F, wf, dt, steps): unit mass x''=-k*x-c*v+F*cos(wf*t) with wf in rad/s, t starting at 0, integrated with classical RK4. Return [x, v, t] rounded to 6.

split: open-access


prompt:
Accepted steps grow erratically and trigger rejection cascades.

solve(y0, lam, s, t_end, dt0, tol): integrate y'=-lam*y+s to t_end with the embedded Euler/Heun pair. err=|y_heun-y_euler|/max(1,|y|) at the step start. Accept if err<=tol (propagate Heun); grow h by min(2, 0.9*(tol/err)^(1/2)) (2 when err=0); on reject shrink by max(0.2, 0.9*(tol/err)^(1/2)). Steps are clipped to t_end; at most 500 attempts. Return [y, accepted, rejected, last h] rounded.

split: open-access


prompt:
The error estimate refers to Heun but the state follows Euler, so accuracy is worse than tol suggests.

solve(y0, lam, s, t_end, dt0, tol): integrate y'=-lam*y+s to t_end with the embedded Euler/Heun pair. err=|y_heun-y_euler|/max(1,|y|) at the step start. Accept if err<=tol (propagate Heun); grow h by min(2, 0.9*(tol/err)^(1/2)) (2 when err=0); on reject shrink by max(0.2, 0.9*(tol/err)^(1/2)). Steps are clipped to t_end; at most 500 attempts. Return [y, accepted, rejected, last h] rounded.

split: open-access


prompt:
The integrator reaches t_end early with the state lagging behind.

solve(y0, lam, s, t_end, dt0, tol): integrate y'=-lam*y+s to t_end with the embedded Euler/Heun pair. err=|y_heun-y_euler|/max(1,|y|) at the step start. Accept if err<=tol (propagate Heun); grow h by min(2, 0.9*(tol/err)^(1/2)) (2 when err=0); on reject shrink by max(0.2, 0.9*(tol/err)^(1/2)). Steps are clipped to t_end; at most 500 attempts. Return [y, accepted, rejected, last h] rounded.

split: open-access


prompt:
The solution is reported for a time later than t_end.

solve(y0, lam, s, t_end, dt0, tol): integrate y'=-lam*y+s to t_end with the embedded Euler/Heun pair. err=|y_heun-y_euler|/max(1,|y|) at the step start. Accept if err<=tol (propagate Heun); grow h by min(2, 0.9*(tol/err)^(1/2)) (2 when err=0); on reject shrink by max(0.2, 0.9*(tol/err)^(1/2)). Steps are clipped to t_end; at most 500 attempts. Return [y, accepted, rejected, last h] rounded.

split: open-access


prompt:
After the solution decays or grows the tolerance is effectively too tight or too loose.

solve(y0, lam, s, t_end, dt0, tol): integrate y'=-lam*y+s to t_end with the embedded Euler/Heun pair. err=|y_heun-y_euler|/max(1,|y|) at the step start. Accept if err<=tol (propagate Heun); grow h by min(2, 0.9*(tol/err)^(1/2)) (2 when err=0); on reject shrink by max(0.2, 0.9*(tol/err)^(1/2)). Steps are clipped to t_end; at most 500 attempts. Return [y, accepted, rejected, last h] rounded.

split: open-access


prompt:
A constant-slope phase keeps the tiny initial step forever and wastes work.

solve(y0, lam, s, t_end, dt0, tol): integrate y'=-lam*y+s to t_end with the embedded Euler/Heun pair. err=|y_heun-y_euler|/max(1,|y|) at the step start. Accept if err<=tol (propagate Heun); grow h by min(2, 0.9*(tol/err)^(1/2)) (2 when err=0); on reject shrink by max(0.2, 0.9*(tol/err)^(1/2)). Steps are clipped to t_end; at most 500 attempts. Return [y, accepted, rejected, last h] rounded.

split: open-access


prompt:
Badly rejected steps retry too large and cause repeated rejections.

solve(y0, lam, s, t_end, dt0, tol): integrate y'=-lam*y+s to t_end with the embedded Euler/Heun pair. err=|y_heun-y_euler|/max(1,|y|) at the step start. Accept if err<=tol (propagate Heun); grow h by min(2, 0.9*(tol/err)^(1/2)) (2 when err=0); on reject shrink by max(0.2, 0.9*(tol/err)^(1/2)). Steps are clipped to t_end; at most 500 attempts. Return [y, accepted, rejected, last h] rounded.

split: open-access


prompt:
The orbit phase is shifted and energy oscillation is biased from the first step.

solve(x0, v0, w2, g, dt, steps): acceleration -w2*x-g. The engine stores velocity at half steps: vh=v0+a(x0)*dt/2, then per step x+=vh*dt; vh+=a(x)*dt. Output synchronizes velocity back to the integer step: [x, vh-a(x)*dt/2] rounded to 6.

split: open-access


prompt:
Velocity output is offset by half a step, corrupting energy and contact logic.

solve(x0, v0, w2, g, dt, steps): acceleration -w2*x-g. The engine stores velocity at half steps: vh=v0+a(x0)*dt/2, then per step x+=vh*dt; vh+=a(x)*dt. Output synchronizes velocity back to the integer step: [x, vh-a(x)*dt/2] rounded to 6.

split: open-access


prompt:
The stored velocity lags a full step behind and the scheme loses time symmetry.

solve(x0, v0, w2, g, dt, steps): acceleration -w2*x-g. The engine stores velocity at half steps: vh=v0+a(x0)*dt/2, then per step x+=vh*dt; vh+=a(x)*dt. Output synchronizes velocity back to the integer step: [x, vh-a(x)*dt/2] rounded to 6.

split: open-access


prompt:
Bodies settle on the wrong side of the spring rest point.

solve(x0, v0, w2, g, dt, steps): acceleration -w2*x-g. The engine stores velocity at half steps: vh=v0+a(x0)*dt/2, then per step x+=vh*dt; vh+=a(x)*dt. Output synchronizes velocity back to the integer step: [x, vh-a(x)*dt/2] rounded to 6.

split: open-access


prompt:
Acceleration is counted twice per step and trajectories overshoot.

solve(x0, v0, w2, g, dt, steps): acceleration -w2*x-g. The engine stores velocity at half steps: vh=v0+a(x0)*dt/2, then per step x+=vh*dt; vh+=a(x)*dt. Output synchronizes velocity back to the integer step: [x, vh-a(x)*dt/2] rounded to 6.

split: open-access


prompt:
Stiff springs at large dt overshoot and gain energy, defeating the implicit scheme.

solve(x0, v0, k, m, c, dt, steps): backward Euler for x'=v, m v'=-k x-c v in closed form v1=(v-dt*k*x/m)/(1+dt*c/m+dt^2*k/m), x1=x+dt*v1. Energy E=0.5 m v^2+0.5 k x^2; report the peak E_n/E_0 including step 0 (0 when E_0=0). Return [x, v, peak] rounded to 6.

split: open-access


prompt:
Position lags the implicit velocity and energy is no longer monotone.

solve(x0, v0, k, m, c, dt, steps): backward Euler for x'=v, m v'=-k x-c v in closed form v1=(v-dt*k*x/m)/(1+dt*c/m+dt^2*k/m), x1=x+dt*v1. Energy E=0.5 m v^2+0.5 k x^2; report the peak E_n/E_0 including step 0 (0 when E_0=0). Return [x, v, peak] rounded to 6.

split: open-access


prompt:
Peak energy ratio is inflated whenever the spring is stretched.

solve(x0, v0, k, m, c, dt, steps): backward Euler for x'=v, m v'=-k x-c v in closed form v1=(v-dt*k*x/m)/(1+dt*c/m+dt^2*k/m), x1=x+dt*v1. Energy E=0.5 m v^2+0.5 k x^2; report the peak E_n/E_0 including step 0 (0 when E_0=0). Return [x, v, peak] rounded to 6.

split: open-access


prompt:
A purely dissipative run reports a peak below one.

solve(x0, v0, k, m, c, dt, steps): backward Euler for x'=v, m v'=-k x-c v in closed form v1=(v-dt*k*x/m)/(1+dt*c/m+dt^2*k/m), x1=x+dt*v1. Energy E=0.5 m v^2+0.5 k x^2; report the peak E_n/E_0 including step 0 (0 when E_0=0). Return [x, v, peak] rounded to 6.

split: open-access


prompt:
Damping strength scales wrongly with body mass.

solve(x0, v0, k, m, c, dt, steps): backward Euler for x'=v, m v'=-k x-c v in closed form v1=(v-dt*k*x/m)/(1+dt*c/m+dt^2*k/m), x1=x+dt*v1. Energy E=0.5 m v^2+0.5 k x^2; report the peak E_n/E_0 including step 0 (0 when E_0=0). Return [x, v, peak] rounded to 6.

split: open-access


prompt:
The implicit solve pushes the mass away from rest.

solve(x0, v0, k, m, c, dt, steps): backward Euler for x'=v, m v'=-k x-c v in closed form v1=(v-dt*k*x/m)/(1+dt*c/m+dt^2*k/m), x1=x+dt*v1. Energy E=0.5 m v^2+0.5 k x^2; report the peak E_n/E_0 including step 0 (0 when E_0=0). Return [x, v, peak] rounded to 6.

split: open-access


prompt:
Whenever the frame time changes the implied velocity jumps.

solve(x0, v0, w2, g, dts): position Verlet with variable steps, acceleration -w2*x+g. First step is Taylor x1=x0+v0*h0+0.5*a(x0)*h0^2; then x_{n+1}=x_n+(x_n-x_{n-1})*(h_n/h_{n-1})+a(x_n)*h_n*(h_n+h_{n-1})/2. Velocity estimate is (x_n-x_{n-1})/h_last. Empty dts returns the initial state. Return [x, v] rounded.

split: open-access


prompt:
Uneven steps inject spurious forces.

solve(x0, v0, w2, g, dts): position Verlet with variable steps, acceleration -w2*x+g. First step is Taylor x1=x0+v0*h0+0.5*a(x0)*h0^2; then x_{n+1}=x_n+(x_n-x_{n-1})*(h_n/h_{n-1})+a(x_n)*h_n*(h_n+h_{n-1})/2. Velocity estimate is (x_n-x_{n-1})/h_last. Empty dts returns the initial state. Return [x, v] rounded.

split: open-access


prompt:
The first displacement is too large and seeds a persistent velocity error.

solve(x0, v0, w2, g, dts): position Verlet with variable steps, acceleration -w2*x+g. First step is Taylor x1=x0+v0*h0+0.5*a(x0)*h0^2; then x_{n+1}=x_n+(x_n-x_{n-1})*(h_n/h_{n-1})+a(x_n)*h_n*(h_n+h_{n-1})/2. Velocity estimate is (x_n-x_{n-1})/h_last. Empty dts returns the initial state. Return [x, v] rounded.

split: open-access


prompt:
Accelerating or decelerating frame rates distort the trajectory in opposite directions.

solve(x0, v0, w2, g, dts): position Verlet with variable steps, acceleration -w2*x+g. First step is Taylor x1=x0+v0*h0+0.5*a(x0)*h0^2; then x_{n+1}=x_n+(x_n-x_{n-1})*(h_n/h_{n-1})+a(x_n)*h_n*(h_n+h_{n-1})/2. Velocity estimate is (x_n-x_{n-1})/h_last. Empty dts returns the initial state. Return [x, v] rounded.

split: open-access


prompt:
Reported velocity is wrong whenever the last step differs from the first.

solve(x0, v0, w2, g, dts): position Verlet with variable steps, acceleration -w2*x+g. First step is Taylor x1=x0+v0*h0+0.5*a(x0)*h0^2; then x_{n+1}=x_n+(x_n-x_{n-1})*(h_n/h_{n-1})+a(x_n)*h_n*(h_n+h_{n-1})/2. Velocity estimate is (x_n-x_{n-1})/h_last. Empty dts returns the initial state. Return [x, v] rounded.

split: open-access


prompt:
Launched bodies start from rest apart from the acceleration term.

solve(x0, v0, w2, g, dts): position Verlet with variable steps, acceleration -w2*x+g. First step is Taylor x1=x0+v0*h0+0.5*a(x0)*h0^2; then x_{n+1}=x_n+(x_n-x_{n-1})*(h_n/h_{n-1})+a(x_n)*h_n*(h_n+h_{n-1})/2. Velocity estimate is (x_n-x_{n-1})/h_last. Empty dts returns the initial state. Return [x, v] rounded.

split: open-access


prompt:
Bodies spin at twice the commanded angular velocity.

solve(q, omega, dt, steps): orientation quaternion [w,x,y,z], world-frame angular velocity omega. Each step q += 0.5*dt*(0,omega) (x) q (Hamilton product, omega on the left), then renormalize to unit length. Return q with w>=0 (negate all components otherwise), rounded to 6.

split: open-access


prompt:
Spinning bodies precess about the wrong axis once they are tilted.

solve(q, omega, dt, steps): orientation quaternion [w,x,y,z], world-frame angular velocity omega. Each step q += 0.5*dt*(0,omega) (x) q (Hamilton product, omega on the left), then renormalize to unit length. Return q with w>=0 (negate all components otherwise), rounded to 6.

split: open-access


prompt:
Rotations about combined axes drift into the wrong orientation.

solve(q, omega, dt, steps): orientation quaternion [w,x,y,z], world-frame angular velocity omega. Each step q += 0.5*dt*(0,omega) (x) q (Hamilton product, omega on the left), then renormalize to unit length. Return q with w>=0 (negate all components otherwise), rounded to 6.

split: open-access


prompt:
Orientation magnitude grows each step and scales transformed geometry.

solve(q, omega, dt, steps): orientation quaternion [w,x,y,z], world-frame angular velocity omega. Each step q += 0.5*dt*(0,omega) (x) q (Hamilton product, omega on the left), then renormalize to unit length. Return q with w>=0 (negate all components otherwise), rounded to 6.

split: open-access


prompt:
Quaternions with negative w are turned into a different rotation.

solve(q, omega, dt, steps): orientation quaternion [w,x,y,z], world-frame angular velocity omega. Each step q += 0.5*dt*(0,omega) (x) q (Hamilton product, omega on the left), then renormalize to unit length. Return q with w>=0 (negate all components otherwise), rounded to 6.

split: open-access


prompt:
Resting contacts jitter because every tiny overlap is pushed apart.

solve(vn, depth, ima, imb, beta, slop, dt, e, e_thresh): one normal contact, vn<0 approaching. bias=(beta/dt)*(depth-slop) if positive; bounce=-e*vn when vn<-e_thresh. Target separating speed is max(bias,bounce); impulse=(target-vn)/(ima+imb) clamped at 0 (no pulling). Zero summed inverse mass gives [0, vn]. Return [impulse, post velocity] rounded to 6.

split: open-access


prompt:
Penetration is corrected far too slowly and objects sink.

solve(vn, depth, ima, imb, beta, slop, dt, e, e_thresh): one normal contact, vn<0 approaching. bias=(beta/dt)*(depth-slop) if positive; bounce=-e*vn when vn<-e_thresh. Target separating speed is max(bias,bounce); impulse=(target-vn)/(ima+imb) clamped at 0 (no pulling). Zero summed inverse mass gives [0, vn]. Return [impulse, post velocity] rounded to 6.

split: open-access


prompt:
Slow resting contacts bounce and never settle.

solve(vn, depth, ima, imb, beta, slop, dt, e, e_thresh): one normal contact, vn<0 approaching. bias=(beta/dt)*(depth-slop) if positive; bounce=-e*vn when vn<-e_thresh. Target separating speed is max(bias,bounce); impulse=(target-vn)/(ima+imb) clamped at 0 (no pulling). Zero summed inverse mass gives [0, vn]. Return [impulse, post velocity] rounded to 6.

split: open-access


prompt:
Penetrating bouncy contacts launch with excess energy.

solve(vn, depth, ima, imb, beta, slop, dt, e, e_thresh): one normal contact, vn<0 approaching. bias=(beta/dt)*(depth-slop) if positive; bounce=-e*vn when vn<-e_thresh. Target separating speed is max(bias,bounce); impulse=(target-vn)/(ima+imb) clamped at 0 (no pulling). Zero summed inverse mass gives [0, vn]. Return [impulse, post velocity] rounded to 6.

split: open-access


prompt:
Separating bodies stick to each other as if glued.

solve(vn, depth, ima, imb, beta, slop, dt, e, e_thresh): one normal contact, vn<0 approaching. bias=(beta/dt)*(depth-slop) if positive; bounce=-e*vn when vn<-e_thresh. Target separating speed is max(bias,bounce); impulse=(target-vn)/(ima+imb) clamped at 0 (no pulling). Zero summed inverse mass gives [0, vn]. Return [impulse, post velocity] rounded to 6.

split: open-access


prompt:
Light bodies get tiny impulses and heavy bodies are over-corrected.

solve(vn, depth, ima, imb, beta, slop, dt, e, e_thresh): one normal contact, vn<0 approaching. bias=(beta/dt)*(depth-slop) if positive; bounce=-e*vn when vn<-e_thresh. Target separating speed is max(bias,bounce); impulse=(target-vn)/(ima+imb) clamped at 0 (no pulling). Zero summed inverse mass gives [0, vn]. Return [impulse, post velocity] rounded to 6.

split: open-access


prompt:
Warm-started contacts can never reduce their impulse and stacks pop apart.

solve(vn0, vt0, w, mu, iterations, cached, warm): several contact points share one relative normal and tangent velocity with inverse mass w. Warm start each point with warm*cached [jn, jt] and apply it to the velocities. Each iteration visits points in order: friction first (accumulated jt clamped to |jt|<=mu*jn), then normal (accumulated jn clamped >=0). Return [jn list, jt list, vn, vt] rounded to 6.

split: open-access


prompt:
Friction vanishes on resting contacts once the normal impulse has converged.

solve(vn0, vt0, w, mu, iterations, cached, warm): several contact points share one relative normal and tangent velocity with inverse mass w. Warm start each point with warm*cached [jn, jt] and apply it to the velocities. Each iteration visits points in order: friction first (accumulated jt clamped to |jt|<=mu*jn), then normal (accumulated jn clamped >=0). Return [jn list, jt list, vn, vt] rounded to 6.

split: open-access


prompt:
Sliding contacts accumulate unbounded friction over iterations.

solve(vn0, vt0, w, mu, iterations, cached, warm): several contact points share one relative normal and tangent velocity with inverse mass w. Warm start each point with warm*cached [jn, jt] and apply it to the velocities. Each iteration visits points in order: friction first (accumulated jt clamped to |jt|<=mu*jn), then normal (accumulated jn clamped >=0). Return [jn list, jt list, vn, vt] rounded to 6.

split: open-access


prompt:
The solver double-applies impulses and contacts bounce on the frame after warm starting.

solve(vn0, vt0, w, mu, iterations, cached, warm): several contact points share one relative normal and tangent velocity with inverse mass w. Warm start each point with warm*cached [jn, jt] and apply it to the velocities. Each iteration visits points in order: friction first (accumulated jt clamped to |jt|<=mu*jn), then normal (accumulated jn clamped >=0). Return [jn list, jt list, vn, vt] rounded to 6.

split: open-access


prompt:
Friction accelerates sliding instead of opposing it.

solve(vn0, vt0, w, mu, iterations, cached, warm): several contact points share one relative normal and tangent velocity with inverse mass w. Warm start each point with warm*cached [jn, jt] and apply it to the velocities. Each iteration visits points in order: friction first (accumulated jt clamped to |jt|<=mu*jn), then normal (accumulated jn clamped >=0). Return [jn list, jt list, vn, vt] rounded to 6.

split: open-access


prompt:
Changing the warm factor has no effect on normal impulses and damping settings misbehave.

solve(vn0, vt0, w, mu, iterations, cached, warm): several contact points share one relative normal and tangent velocity with inverse mass w. Warm start each point with warm*cached [jn, jt] and apply it to the velocities. Each iteration visits points in order: friction first (accumulated jt clamped to |jt|<=mu*jn), then normal (accumulated jn clamped >=0). Return [jn list, jt list, vn, vt] rounded to 6.

split: open-access


prompt:
High damping at coarse steps flips the velocity sign and the body jitters.

solve(v, omega, lin_damp, ang_damp, dt, max_speed, sleep_lin, sleep_ang, sleep_time, kicks): per frame, a sleeping body wakes (timer reset) only when that frame's kick is nonzero, else it is skipped. Add the kick [dvx,dvy,domega], damp with 1/(1+dt*c) (linear and angular coefficients), clamp speed magnitude, then accumulate sleep time while |v|<sleep_lin and |omega|<sleep_ang (else reset). When timer>=sleep_time the body sleeps and velocities are zeroed. Return [vx, vy, omega, timer, asleep, frame index slept or -1].

split: open-access


prompt:
Diagonal motion exceeds the speed cap by up to sqrt(2) and changes direction.

solve(v, omega, lin_damp, ang_damp, dt, max_speed, sleep_lin, sleep_ang, sleep_time, kicks): per frame, a sleeping body wakes (timer reset) only when that frame's kick is nonzero, else it is skipped. Add the kick [dvx,dvy,domega], damp with 1/(1+dt*c) (linear and angular coefficients), clamp speed magnitude, then accumulate sleep time while |v|<sleep_lin and |omega|<sleep_ang (else reset). When timer>=sleep_time the body sleeps and velocities are zeroed. Return [vx, vy, omega, timer, asleep, frame index slept or -1].

split: open-access


prompt:
Bodies that move briefly fall asleep mid-motion.

solve(v, omega, lin_damp, ang_damp, dt, max_speed, sleep_lin, sleep_ang, sleep_time, kicks): per frame, a sleeping body wakes (timer reset) only when that frame's kick is nonzero, else it is skipped. Add the kick [dvx,dvy,domega], damp with 1/(1+dt*c) (linear and angular coefficients), clamp speed magnitude, then accumulate sleep time while |v|<sleep_lin and |omega|<sleep_ang (else reset). When timer>=sleep_time the body sleeps and velocities are zeroed. Return [vx, vy, omega, timer, asleep, frame index slept or -1].

split: open-access


prompt:
Spinning bodies with no linear motion fall asleep and freeze.

solve(v, omega, lin_damp, ang_damp, dt, max_speed, sleep_lin, sleep_ang, sleep_time, kicks): per frame, a sleeping body wakes (timer reset) only when that frame's kick is nonzero, else it is skipped. Add the kick [dvx,dvy,domega], damp with 1/(1+dt*c) (linear and angular coefficients), clamp speed magnitude, then accumulate sleep time while |v|<sleep_lin and |omega|<sleep_ang (else reset). When timer>=sleep_time the body sleeps and velocities are zeroed. Return [vx, vy, omega, timer, asleep, frame index slept or -1].

split: open-access


prompt:
A sleeping crate hit by a kick stays frozen.

solve(v, omega, lin_damp, ang_damp, dt, max_speed, sleep_lin, sleep_ang, sleep_time, kicks): per frame, a sleeping body wakes (timer reset) only when that frame's kick is nonzero, else it is skipped. Add the kick [dvx,dvy,domega], damp with 1/(1+dt*c) (linear and angular coefficients), clamp speed magnitude, then accumulate sleep time while |v|<sleep_lin and |omega|<sleep_ang (else reset). When timer>=sleep_time the body sleeps and velocities are zeroed. Return [vx, vy, omega, timer, asleep, frame index slept or -1].

split: open-access


prompt:
Tuning angular damping has no effect.

solve(v, omega, lin_damp, ang_damp, dt, max_speed, sleep_lin, sleep_ang, sleep_time, kicks): per frame, a sleeping body wakes (timer reset) only when that frame's kick is nonzero, else it is skipped. Add the kick [dvx,dvy,domega], damp with 1/(1+dt*c) (linear and angular coefficients), clamp speed magnitude, then accumulate sleep time while |v|<sleep_lin and |omega|<sleep_ang (else reset). When timer>=sleep_time the body sleeps and velocities are zeroed. Return [vx, vy, omega, timer, asleep, frame index slept or -1].

split: open-access