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

N = 1
observations = []
def solve(commands, size):
    out=[]
    for clips,culls,clip_mask,cull_mask,discard in commands:
        if discard or not clips: out.append('discarded'); continue
        reject=False
        partial=False
        for plane in range(size):
            if clip_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in clips]
                if any(x<0 for x in values): reject=True
                if any(x<0 for x in values): partial=True
            if cull_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in culls]
                if values and all(x<0 for x in values): reject=True
        out.append('discarded' if reject else 'clipped' if partial else 'accepted')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 4), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 4), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 4), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 4), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 4), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 4), ['accepted'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 4), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 4), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 4), ['accepted'])
if N == 2:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 5), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 5), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 5), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 5), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 5), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 5), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 5), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 5), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 5), ['accepted'])
if N == 3:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 6), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 6), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 6), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 6), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 6), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 6), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 6), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 6), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 6), ['accepted'])
if N == 4:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 7), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 7), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 7), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 7), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 7), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 7), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 7), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 7), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 7), ['accepted'])
if N == 5:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 8), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 8), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 8), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 8), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 8), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 8), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 8), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 8), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 8), ['accepted'])
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(commands, size):
    out=[]
    for clips,culls,clip_mask,cull_mask,discard in commands:
        if discard or not clips: out.append('discarded'); continue
        reject=False
        partial=False
        for plane in range(size):
            if clip_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in clips]
                if sum(x<0 for x in values)>len(values)//2: reject=True
                if any(x<0 for x in values): partial=True
            if cull_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in culls]
                if values and all(x<0 for x in values): reject=True
        out.append('discarded' if reject else 'clipped' if partial else 'accepted')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 4), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 4), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 4), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 4), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 4), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 4), ['accepted'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 4), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 4), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 4), ['accepted'])
if N == 2:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 5), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 5), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 5), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 5), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 5), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 5), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 5), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 5), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 5), ['accepted'])
if N == 3:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 6), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 6), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 6), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 6), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 6), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 6), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 6), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 6), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 6), ['accepted'])
if N == 4:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 7), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 7), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 7), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 7), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 7), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 7), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 7), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 7), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 7), ['accepted'])
if N == 5:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 8), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 8), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 8), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 8), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 8), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 8), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 8), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 8), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 8), ['accepted'])
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:
A single negative clip vertex rejects a straddling primitive instead of clipping it.

Each primitive carries per-vertex clip-distance and cull-distance arrays, active bitmasks and a raster-discard flag. A primitive is rejected if every vertex is negative on any one enabled clip or cull plane. Surviving primitives need clipping if any enabled clip distance is negative; cull distances never cause partial clipping. Missing components default to zero and disabled plane bits are ignored. Empty primitives and raster-discarded primitives emit discarded. Only low size plane slots exist.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    out=[]
    for clips,culls,clip_mask,cull_mask,discard in commands:
        if discard or not clips: out.append('discarded'); continue
        reject=False
        partial=False
        for plane in range(size):
            if clip_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in clips]
                if all(x<0 for x in values): reject=True
                if all(x<0 for x in values): partial=True
            if cull_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in culls]
                if values and all(x<0 for x in values): reject=True
        out.append('discarded' if reject else 'clipped' if partial else 'accepted')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 4), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 4), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 4), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 4), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 4), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 4), ['accepted'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 4), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 4), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 4), ['accepted'])
if N == 2:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 5), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 5), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 5), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 5), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 5), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 5), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 5), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 5), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 5), ['accepted'])
if N == 3:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 6), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 6), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 6), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 6), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 6), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 6), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 6), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 6), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 6), ['accepted'])
if N == 4:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 7), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 7), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 7), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 7), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 7), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 7), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 7), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 7), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 7), ['accepted'])
if N == 5:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 8), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 8), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 8), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 8), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 8), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 8), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 8), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 8), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 8), ['accepted'])
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

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

N = 1
observations = []
def solve(commands, size):
    out=[]
    for clips,culls,clip_mask,cull_mask,discard in commands:
        if discard or not clips: out.append('discarded'); continue
        reject=False
        partial=False
        for plane in range(size):
            if clip_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in clips]
                if all(x<0 for x in values): reject=True
                if values[0]<0: partial=True
            if cull_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in culls]
                if values and all(x<0 for x in values): reject=True
        out.append('discarded' if reject else 'clipped' if partial else 'accepted')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 4), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 4), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 4), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 4), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 4), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 4), ['accepted'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 4), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 4), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 4), ['accepted'])
if N == 2:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 5), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 5), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 5), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 5), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 5), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 5), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 5), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 5), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 5), ['accepted'])
if N == 3:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 6), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 6), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 6), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 6), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 6), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 6), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 6), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 6), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 6), ['accepted'])
if N == 4:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 7), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 7), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 7), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 7), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 7), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 7), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 7), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 7), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 7), ['accepted'])
if N == 5:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 8), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 8), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 8), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 8), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 8), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 8), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 8), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 8), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 8), ['accepted'])
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:
A surviving plane-straddling primitive is classified accepted and skips clipping.

Each primitive carries per-vertex clip-distance and cull-distance arrays, active bitmasks and a raster-discard flag. A primitive is rejected if every vertex is negative on any one enabled clip or cull plane. Surviving primitives need clipping if any enabled clip distance is negative; cull distances never cause partial clipping. Missing components default to zero and disabled plane bits are ignored. Empty primitives and raster-discarded primitives emit discarded. Only low size plane slots exist.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    out=[]
    for clips,culls,clip_mask,cull_mask,discard in commands:
        if discard or not clips: out.append('discarded'); continue
        reject=False
        partial=False
        for plane in range(size):
            if clip_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in clips]
                if all(x<0 for x in values): reject=True
                if any(x<0 for x in values): partial=True
            if cull_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in culls]
                if values and any(x<0 for x in values): reject=True
        out.append('discarded' if reject else 'clipped' if partial else 'accepted')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 4), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 4), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 4), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 4), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 4), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 4), ['accepted'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 4), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 4), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 4), ['accepted'])
if N == 2:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 5), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 5), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 5), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 5), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 5), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 5), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 5), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 5), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 5), ['accepted'])
if N == 3:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 6), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 6), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 6), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 6), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 6), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 6), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 6), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 6), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 6), ['accepted'])
if N == 4:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 7), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 7), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 7), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 7), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 7), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 7), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 7), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 7), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 7), ['accepted'])
if N == 5:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 8), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 8), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 8), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 8), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 8), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 8), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 8), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 8), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 8), ['accepted'])
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(commands, size):
    out=[]
    for clips,culls,clip_mask,cull_mask,discard in commands:
        if discard or not clips: out.append('discarded'); continue
        reject=False
        partial=False
        for plane in range(size):
            if clip_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in clips]
                if all(x<0 for x in values): reject=True
                if any(x<0 for x in values): partial=True
            if cull_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in culls]
                if values and sum(values)<0: reject=True
        out.append('discarded' if reject else 'clipped' if partial else 'accepted')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 4), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 4), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 4), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 4), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 4), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 4), ['accepted'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 4), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 4), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 4), ['accepted'])
if N == 2:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 5), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 5), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 5), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 5), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 5), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 5), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 5), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 5), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 5), ['accepted'])
if N == 3:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 6), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 6), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 6), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 6), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 6), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 6), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 6), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 6), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 6), ['accepted'])
if N == 4:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 7), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 7), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 7), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 7), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 7), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 7), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 7), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 7), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 7), ['accepted'])
if N == 5:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 8), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 8), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 8), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 8), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 8), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 8), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 8), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 8), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 8), ['accepted'])
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:
Cull distances reject primitives with one negative vertex rather than requiring the full primitive outside.

Each primitive carries per-vertex clip-distance and cull-distance arrays, active bitmasks and a raster-discard flag. A primitive is rejected if every vertex is negative on any one enabled clip or cull plane. Surviving primitives need clipping if any enabled clip distance is negative; cull distances never cause partial clipping. Missing components default to zero and disabled plane bits are ignored. Empty primitives and raster-discarded primitives emit discarded. Only low size plane slots exist.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    out=[]
    for clips,culls,clip_mask,cull_mask,discard in commands:
        if discard or not clips: out.append('discarded'); continue
        reject=False
        partial=False
        for plane in range(size):
            if clip_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in clips]
                if all(x<0 for x in values): reject=True
                if any(x<0 for x in values): partial=True
            if cull_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in culls]
                if values and all(x<0 for x in values): reject=True
                elif any(x<0 for x in values): partial=True
        out.append('discarded' if reject else 'clipped' if partial else 'accepted')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 4), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 4), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 4), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 4), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 4), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 4), ['accepted'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 4), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 4), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 4), ['accepted'])
if N == 2:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 5), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 5), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 5), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 5), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 5), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 5), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 5), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 5), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 5), ['accepted'])
if N == 3:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 6), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 6), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 6), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 6), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 6), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 6), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 6), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 6), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 6), ['accepted'])
if N == 4:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 7), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 7), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 7), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 7), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 7), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 7), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 7), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 7), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 7), ['accepted'])
if N == 5:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 8), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 8), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 8), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 8), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 8), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 8), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 8), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 8), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 8), ['accepted'])
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(commands, size):
    out=[]
    for clips,culls,clip_mask,cull_mask,discard in commands:
        if discard or not clips: out.append('discarded'); continue
        reject=False
        partial=False
        for plane in range(size):
            if clip_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in clips]
                if all(x<0 for x in values): reject=True
                if any(x<0 for x in values): partial=True
            if cull_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in culls]
                if values and all(x<0 for x in values): reject=True
                elif values and values[0]<0: partial=True
        out.append('discarded' if reject else 'clipped' if partial else 'accepted')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 4), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 4), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 4), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 4), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 4), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 4), ['accepted'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 4), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 4), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 4), ['accepted'])
if N == 2:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 5), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 5), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 5), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 5), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 5), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 5), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 5), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 5), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 5), ['accepted'])
if N == 3:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 6), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 6), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 6), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 6), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 6), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 6), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 6), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 6), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 6), ['accepted'])
if N == 4:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 7), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 7), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 7), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 7), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 7), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 7), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 7), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 7), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 7), ['accepted'])
if N == 5:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 8), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 8), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 8), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 8), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 8), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 8), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 8), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 8), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 8), ['accepted'])
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:
Mixed-sign cull planes incorrectly request geometric clipping.

Each primitive carries per-vertex clip-distance and cull-distance arrays, active bitmasks and a raster-discard flag. A primitive is rejected if every vertex is negative on any one enabled clip or cull plane. Surviving primitives need clipping if any enabled clip distance is negative; cull distances never cause partial clipping. Missing components default to zero and disabled plane bits are ignored. Empty primitives and raster-discarded primitives emit discarded. Only low size plane slots exist.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    out=[]
    for clips,culls,clip_mask,cull_mask,discard in commands:
        if discard or not clips: out.append('discarded'); continue
        reject=False
        partial=False
        for plane in range(size):
            if clip_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else -1 for v in clips]
                if all(x<0 for x in values): reject=True
                if any(x<0 for x in values): partial=True
            if cull_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in culls]
                if values and all(x<0 for x in values): reject=True
        out.append('discarded' if reject else 'clipped' if partial else 'accepted')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 4), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 4), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 4), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 4), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 4), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 4), ['accepted'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 4), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 4), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 4), ['accepted'])
if N == 2:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 5), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 5), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 5), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 5), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 5), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 5), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 5), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 5), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 5), ['accepted'])
if N == 3:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 6), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 6), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 6), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 6), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 6), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 6), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 6), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 6), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 6), ['accepted'])
if N == 4:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 7), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 7), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 7), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 7), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 7), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 7), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 7), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 7), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 7), ['accepted'])
if N == 5:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 8), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 8), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 8), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 8), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 8), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 8), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 8), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 8), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 8), ['accepted'])
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(commands, size):
    out=[]
    for clips,culls,clip_mask,cull_mask,discard in commands:
        if discard or not clips: out.append('discarded'); continue
        reject=False
        partial=False
        for plane in range(size):
            if clip_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else (v[-1] if v else 0) for v in clips]
                if all(x<0 for x in values): reject=True
                if any(x<0 for x in values): partial=True
            if cull_mask & (1<<plane):
                values=[v[plane] if plane<len(v) else 0 for v in culls]
                if values and all(x<0 for x in values): reject=True
        out.append('discarded' if reject else 'clipped' if partial else 'accepted')
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 4), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 4), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 4), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 4), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 4), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 4), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 4), ['accepted'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 4), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 4), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 4), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 4), ['accepted'])
if N == 2:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 5), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 5), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 5), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 5), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 5), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 5), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 5), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 5), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 5), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 5), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 5), ['accepted'])
if N == 3:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 6), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 6), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 6), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 6), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 6), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 6), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 6), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 6), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 6), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 6), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 6), ['accepted'])
if N == 4:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 7), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 7), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 7), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 7), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 7), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 7), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 7), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 7), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 7), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 7), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 7), ['accepted'])
if N == 5:
    check('explicit sequence 0', solve([[[[1], [1]], [[1], [1]], 1, 0, True]], 8), ['discarded'])
    check('explicit sequence 1', solve([[[[-1], [1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 2', solve([[[[1], [-1]], [[0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 3', solve([[[[1], [1]], [[-3], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 4', solve([[[[1], [1]], [[-1], [1]], 0, 1, False]], 8), ['accepted'])
    check('explicit sequence 5', solve([[[[-1], [-1]], [[0], [0]], 2, 0, False]], 8), ['accepted'])
    check('explicit sequence 6', solve([[[[0], [0]], [[-1], [-1]], 0, 2, False]], 8), ['accepted'])
    check('explicit sequence 7', solve([[[[1], [1]], [[-1], [-1]], 0, 1, False]], 8), ['discarded'])
    check('explicit sequence 8', solve([[[[-1], [1]], [[-1], [-1]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 9', solve([[[[-1, 1], [1, 1]], [[-1], [-1]], 1, 1, False]], 8), ['discarded'])
    check('explicit sequence 10', solve([[[[1, 1, 1, 1, -1], [1, 1, 1, 1, -1]], [[0], [0]], 16, 0, False]], 8), ['discarded'])
    check('explicit sequence 11', solve([[[], [], 0, 0, False]], 8), ['discarded'])
    check('explicit sequence 12', solve([[[[0], [0]], [[0], [0]], 1, 1, False]], 8), ['accepted'])
    check('explicit sequence 13', solve([[[[-1], [-1], [1]], [[0], [0], [0]], 1, 0, False]], 8), ['clipped'])
    check('explicit sequence 14', solve([[[[-1], [1]], [[0], [0]], 0, 1, False]], 8), ['accepted'])
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:
Absent clip-distance components are treated as outside rather than on the plane.

Each primitive carries per-vertex clip-distance and cull-distance arrays, active bitmasks and a raster-discard flag. A primitive is rejected if every vertex is negative on any one enabled clip or cull plane. Surviving primitives need clipping if any enabled clip distance is negative; cull distances never cause partial clipping. Missing components default to zero and disabled plane bits are ignored. Empty primitives and raster-discarded primitives emit discarded. Only low size plane slots exist.

split: open-access