FA-92116 / PLC ladder logic scan cycles / Open access
Shift register moves tracking bits toward the load end · case 01
Part-present bits travel backwards along the conveyor model.
ROOT CAUSE
The shift drops bit 0 and appends the sensor at the far end.
VERIFIED REPAIR
Insert the sensor at index 0 and drop the far-end bit.
Unsuccessful approach: Inserting the sensor at index 0 but dropping index 0 of the old register loses the part at the load station.
Case contract
Bit shift left (BSL) register tracking parts on a conveyor. On each rising edge of the encoder clock the bit at the far end (index length-1) moves to the unload bit, every bit moves one position toward the far end, and bit 0 loads the part-present sensor sampled on that same scan. The unload bit holds its value until the next shift. pulses is a list of [clock, sensor]; return [register string index 0 first, unload] per scan.
Why this case matters
Ladder programs are executed as repeated scans; each defect here changes what a rung, timer, counter or data-table instruction reports on a particular scan, which is how commissioning and field faults are actually observed.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(length, pulses):
bits = [0] * length
prev = False
unload = 0
out = []
for clock, sensor in pulses:
clock = bool(clock)
if clock and not prev:
unload = bits[length - 1]
bits = bits[1:] + [1 if sensor else 0]
prev = clock
out.append([''.join(str(b) for b in bits), unload])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['regression: scenario 1',
[6,
[[True, 0],
[True, 0],
[False, 1],
[False, 0],
[True, 0],
[True, 0],
[False, 0],
[True, 1],
[False, 1],
[False, 1],
[False, 1],
[True, 1],
[True, 0],
[False, 1],
[False, 0]]],
[['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0]]],
['regression: scenario 2',
[2, [[False, 0], [False, 0], [False, 0], [False, 0], [False, 1], [True, 1], [False, 0], [True, 0]]],
[['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['10', 0], ['10', 0], ['01', 0]]],
['regression: scenario 3',
[5,
[[True, 0],
[True, 1],
[False, 0],
[True, 1],
[False, 0],
[False, 1],
[True, 0],
[True, 1],
[True, 0],
[True, 1],
[True, 0]]],
[['00000', 0],
['00000', 0],
['00000', 0],
['10000', 0],
['10000', 0],
['10000', 0],
['01000', 0],
['01000', 0],
['01000', 0],
['01000', 0],
['01000', 0]]],
['control: scenario 4',
[1,
[[False, 1],
[False, 1],
[True, 0],
[False, 1],
[True, 1],
[False, 0],
[False, 1],
[True, 0],
[True, 1],
[False, 0],
[False, 1],
[True, 0],
[False, 1],
[False, 1],
[True, 0],
[True, 0]]],
[['0', 0],
['0', 0],
['0', 0],
['0', 0],
['1', 0],
['1', 0],
['1', 0],
['0', 1],
['0', 1],
['0', 1],
['0', 1],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0]]]],
[['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['regression: scenario 4',
[2,
[[False, 0],
[True, 1],
[True, 1],
[True, 0],
[False, 0],
[False, 0],
[False, 1],
[True, 0],
[False, 0],
[True, 0]]],
[['00', 0],
['10', 0],
['10', 0],
['10', 0],
['10', 0],
['10', 0],
['10', 0],
['01', 0],
['01', 0],
['00', 1]]],
['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['control: scenario 1',
[2,
[[False, 1],
[False, 0],
[True, 0],
[False, 0],
[True, 0],
[True, 0],
[True, 0],
[True, 0],
[False, 0],
[False, 1],
[True, 0],
[True, 1],
[False, 1]]],
[['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0]]],
['control: scenario 2',
[2,
[[True, 0], [False, 1], [False, 1], [True, 0], [False, 1], [False, 0], [True, 0], [False, 1], [True, 0]]],
[['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0]]],
['control: scenario 3',
[1,
[[False, 1],
[False, 0],
[True, 0],
[True, 0],
[True, 1],
[False, 1],
[False, 0],
[False, 1],
[True, 1],
[False, 0],
[True, 0],
[True, 0],
[True, 1],
[False, 0],
[True, 1],
[False, 0]]],
[['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['1', 0],
['1', 0],
['0', 1],
['0', 1],
['0', 1],
['0', 1],
['1', 0],
['1', 0]]]],
[['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['regression: scenario 1',
[4,
[[False, 0],
[False, 1],
[True, 1],
[True, 1],
[True, 1],
[True, 0],
[False, 1],
[True, 1],
[True, 0],
[False, 1],
[True, 1],
[True, 1]]],
[['0000', 0],
['0000', 0],
['1000', 0],
['1000', 0],
['1000', 0],
['1000', 0],
['1000', 0],
['1100', 0],
['1100', 0],
['1100', 0],
['1110', 0],
['1110', 0]]],
['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['control: scenario 2',
[1,
[[True, 0],
[False, 0],
[False, 1],
[True, 1],
[False, 0],
[False, 0],
[True, 1],
[True, 1],
[True, 1],
[True, 1],
[False, 1],
[True, 0]]],
[['0', 0],
['0', 0],
['0', 0],
['1', 0],
['1', 0],
['1', 0],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['0', 1]]],
['control: scenario 3',
[6, [[False, 1], [False, 0], [True, 0], [True, 1], [True, 0], [False, 0], [True, 0], [True, 0]]],
[['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0]]],
['regression: scenario 4',
[2,
[[False, 0],
[True, 0],
[True, 0],
[False, 0],
[True, 0],
[False, 0],
[True, 1],
[True, 0],
[True, 0],
[True, 0]]],
[['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['10', 0],
['10', 0],
['10', 0],
['10', 0]]]],
[['regression: scenario 1',
[2, [[True, 0], [False, 1], [True, 0], [False, 0], [False, 1], [False, 1], [True, 1], [True, 1]]],
[['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['10', 0], ['10', 0]]],
['regression: scenario 3',
[3,
[[False, 1],
[False, 1],
[True, 0],
[False, 0],
[False, 0],
[True, 1],
[True, 1],
[True, 0],
[False, 0],
[True, 0],
[True, 1],
[False, 0]]],
[['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['100', 0],
['100', 0],
['100', 0],
['100', 0],
['010', 0],
['010', 0],
['010', 0]]],
['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['regression: scenario 2',
[3,
[[True, 0],
[False, 1],
[False, 0],
[True, 0],
[True, 1],
[False, 0],
[True, 0],
[False, 0],
[False, 0],
[True, 1],
[False, 1],
[False, 1],
[True, 0],
[False, 0],
[True, 1]]],
[['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['100', 0],
['100', 0],
['100', 0],
['010', 0],
['010', 0],
['101', 0]]],
['control: scenario 4',
[1,
[[True, 1],
[False, 0],
[False, 0],
[True, 1],
[True, 1],
[False, 1],
[False, 1],
[False, 0],
[False, 1],
[True, 0],
[False, 1],
[False, 0],
[True, 0],
[False, 1]]],
[['1', 0],
['1', 0],
['1', 0],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['0', 1],
['0', 1],
['0', 1],
['0', 0],
['0', 0]]]],
[['regression: scenario 5',
[6,
[[True, 0],
[True, 1],
[False, 0],
[False, 1],
[False, 0],
[False, 1],
[False, 0],
[False, 0],
[True, 1],
[True, 1],
[True, 1],
[False, 0],
[False, 1],
[False, 0],
[True, 0]]],
[['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['010000', 0]]],
['regression: scenario 7',
[6,
[[True, 1],
[False, 0],
[False, 1],
[False, 0],
[True, 1],
[True, 0],
[False, 0],
[False, 0],
[False, 1],
[False, 0],
[False, 0],
[True, 1],
[True, 0],
[False, 0],
[True, 1]]],
[['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['111000', 0],
['111000', 0],
['111000', 0],
['111100', 0]]],
['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['regression: scenario 1',
[3,
[[False, 0],
[True, 1],
[True, 0],
[False, 0],
[False, 1],
[True, 0],
[True, 1],
[False, 0],
[True, 1],
[False, 1],
[True, 0],
[True, 1],
[False, 1],
[False, 1],
[True, 0]]],
[['000', 0],
['100', 0],
['100', 0],
['100', 0],
['100', 0],
['010', 0],
['010', 0],
['010', 0],
['101', 0],
['101', 0],
['010', 1],
['010', 1],
['010', 1],
['010', 1],
['001', 0]]],
['control: scenario 2',
[6,
[[True, 0],
[True, 0],
[False, 0],
[True, 0],
[False, 1],
[False, 0],
[True, 0],
[False, 1],
[True, 0],
[True, 1],
[True, 1],
[False, 0]]],
[['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0]]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: three stage track | [['001', 0], ['001', 0], ['010', 1], ['010', 1], ['101', 0], ['101', 0], ['010', 1]] | [['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]] | Failed |
| regression: clock held high | [['01', 0], ['01', 0], ['01', 0], ['01', 0], ['10', 1]] | [['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]] | Failed |
| control: single stage | [['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]] | [['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]] | Passed |
| regression: sensor changes on edge scan | [['000', 0], ['000', 0], ['000', 0], ['001', 0], ['001', 0]] | [['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]] | Failed |
| regression: scenario 1 | [['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000001', 0], ['000001', 0], ['000001', 0], ['000001', 0], ['000011', 1], ['000011', 1], ['000011', 1], ['000011', 1]] | [['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['100000', 0], ['100000', 0], ['100000', 0], ['100000', 0], ['110000', 0], ['110000', 0], ['110000', 0], ['110000', 0]] | Failed |
| regression: scenario 2 | [['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['01', 0], ['01', 0], ['10', 1]] | [['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['10', 0], ['10', 0], ['01', 0]] | Failed |
| regression: scenario 3 | [['00000', 0], ['00000', 0], ['00000', 0], ['00001', 0], ['00001', 0], ['00001', 0], ['00010', 1], ['00010', 1], ['00010', 1], ['00010', 1], ['00010', 1]] | [['00000', 0], ['00000', 0], ['00000', 0], ['10000', 0], ['10000', 0], ['10000', 0], ['01000', 0], ['01000', 0], ['01000', 0], ['01000', 0], ['01000', 0]] | Failed |
| control: scenario 4 | [['0', 0], ['0', 0], ['0', 0], ['0', 0], ['1', 0], ['1', 0], ['1', 0], ['0', 1], ['0', 1], ['0', 1], ['0', 1], ['0', 0], ['0', 0], ['0', 0], ['0', 0], ['0', 0]] | [['0', 0], ['0', 0], ['0', 0], ['0', 0], ['1', 0], ['1', 0], ['1', 0], ['0', 1], ['0', 1], ['0', 1], ['0', 1], ['0', 0], ['0', 0], ['0', 0], ['0', 0], ['0', 0]] | Passed |
SHA-256 / 146e30ee509eb5afc8279ec103e6b3abc3444a71a7d6d87f87e2468045d235c1
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(length, pulses):
bits = [0] * length
prev = False
unload = 0
out = []
for clock, sensor in pulses:
clock = bool(clock)
if clock and not prev:
unload = bits[length - 1]
bits = [1 if sensor else 0] + bits[1:]
prev = clock
out.append([''.join(str(b) for b in bits), unload])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['regression: scenario 1',
[6,
[[True, 0],
[True, 0],
[False, 1],
[False, 0],
[True, 0],
[True, 0],
[False, 0],
[True, 1],
[False, 1],
[False, 1],
[False, 1],
[True, 1],
[True, 0],
[False, 1],
[False, 0]]],
[['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0]]],
['regression: scenario 2',
[2, [[False, 0], [False, 0], [False, 0], [False, 0], [False, 1], [True, 1], [False, 0], [True, 0]]],
[['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['10', 0], ['10', 0], ['01', 0]]],
['regression: scenario 3',
[5,
[[True, 0],
[True, 1],
[False, 0],
[True, 1],
[False, 0],
[False, 1],
[True, 0],
[True, 1],
[True, 0],
[True, 1],
[True, 0]]],
[['00000', 0],
['00000', 0],
['00000', 0],
['10000', 0],
['10000', 0],
['10000', 0],
['01000', 0],
['01000', 0],
['01000', 0],
['01000', 0],
['01000', 0]]],
['control: scenario 4',
[1,
[[False, 1],
[False, 1],
[True, 0],
[False, 1],
[True, 1],
[False, 0],
[False, 1],
[True, 0],
[True, 1],
[False, 0],
[False, 1],
[True, 0],
[False, 1],
[False, 1],
[True, 0],
[True, 0]]],
[['0', 0],
['0', 0],
['0', 0],
['0', 0],
['1', 0],
['1', 0],
['1', 0],
['0', 1],
['0', 1],
['0', 1],
['0', 1],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0]]]],
[['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['regression: scenario 4',
[2,
[[False, 0],
[True, 1],
[True, 1],
[True, 0],
[False, 0],
[False, 0],
[False, 1],
[True, 0],
[False, 0],
[True, 0]]],
[['00', 0],
['10', 0],
['10', 0],
['10', 0],
['10', 0],
['10', 0],
['10', 0],
['01', 0],
['01', 0],
['00', 1]]],
['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['control: scenario 1',
[2,
[[False, 1],
[False, 0],
[True, 0],
[False, 0],
[True, 0],
[True, 0],
[True, 0],
[True, 0],
[False, 0],
[False, 1],
[True, 0],
[True, 1],
[False, 1]]],
[['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0]]],
['control: scenario 2',
[2,
[[True, 0], [False, 1], [False, 1], [True, 0], [False, 1], [False, 0], [True, 0], [False, 1], [True, 0]]],
[['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0]]],
['control: scenario 3',
[1,
[[False, 1],
[False, 0],
[True, 0],
[True, 0],
[True, 1],
[False, 1],
[False, 0],
[False, 1],
[True, 1],
[False, 0],
[True, 0],
[True, 0],
[True, 1],
[False, 0],
[True, 1],
[False, 0]]],
[['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['1', 0],
['1', 0],
['0', 1],
['0', 1],
['0', 1],
['0', 1],
['1', 0],
['1', 0]]]],
[['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['regression: scenario 1',
[4,
[[False, 0],
[False, 1],
[True, 1],
[True, 1],
[True, 1],
[True, 0],
[False, 1],
[True, 1],
[True, 0],
[False, 1],
[True, 1],
[True, 1]]],
[['0000', 0],
['0000', 0],
['1000', 0],
['1000', 0],
['1000', 0],
['1000', 0],
['1000', 0],
['1100', 0],
['1100', 0],
['1100', 0],
['1110', 0],
['1110', 0]]],
['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['control: scenario 2',
[1,
[[True, 0],
[False, 0],
[False, 1],
[True, 1],
[False, 0],
[False, 0],
[True, 1],
[True, 1],
[True, 1],
[True, 1],
[False, 1],
[True, 0]]],
[['0', 0],
['0', 0],
['0', 0],
['1', 0],
['1', 0],
['1', 0],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['0', 1]]],
['control: scenario 3',
[6, [[False, 1], [False, 0], [True, 0], [True, 1], [True, 0], [False, 0], [True, 0], [True, 0]]],
[['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0]]],
['regression: scenario 4',
[2,
[[False, 0],
[True, 0],
[True, 0],
[False, 0],
[True, 0],
[False, 0],
[True, 1],
[True, 0],
[True, 0],
[True, 0]]],
[['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['10', 0],
['10', 0],
['10', 0],
['10', 0]]]],
[['regression: scenario 1',
[2, [[True, 0], [False, 1], [True, 0], [False, 0], [False, 1], [False, 1], [True, 1], [True, 1]]],
[['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['10', 0], ['10', 0]]],
['regression: scenario 3',
[3,
[[False, 1],
[False, 1],
[True, 0],
[False, 0],
[False, 0],
[True, 1],
[True, 1],
[True, 0],
[False, 0],
[True, 0],
[True, 1],
[False, 0]]],
[['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['100', 0],
['100', 0],
['100', 0],
['100', 0],
['010', 0],
['010', 0],
['010', 0]]],
['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['regression: scenario 2',
[3,
[[True, 0],
[False, 1],
[False, 0],
[True, 0],
[True, 1],
[False, 0],
[True, 0],
[False, 0],
[False, 0],
[True, 1],
[False, 1],
[False, 1],
[True, 0],
[False, 0],
[True, 1]]],
[['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['100', 0],
['100', 0],
['100', 0],
['010', 0],
['010', 0],
['101', 0]]],
['control: scenario 4',
[1,
[[True, 1],
[False, 0],
[False, 0],
[True, 1],
[True, 1],
[False, 1],
[False, 1],
[False, 0],
[False, 1],
[True, 0],
[False, 1],
[False, 0],
[True, 0],
[False, 1]]],
[['1', 0],
['1', 0],
['1', 0],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['0', 1],
['0', 1],
['0', 1],
['0', 0],
['0', 0]]]],
[['regression: scenario 5',
[6,
[[True, 0],
[True, 1],
[False, 0],
[False, 1],
[False, 0],
[False, 1],
[False, 0],
[False, 0],
[True, 1],
[True, 1],
[True, 1],
[False, 0],
[False, 1],
[False, 0],
[True, 0]]],
[['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['010000', 0]]],
['regression: scenario 7',
[6,
[[True, 1],
[False, 0],
[False, 1],
[False, 0],
[True, 1],
[True, 0],
[False, 0],
[False, 0],
[False, 1],
[False, 0],
[False, 0],
[True, 1],
[True, 0],
[False, 0],
[True, 1]]],
[['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['111000', 0],
['111000', 0],
['111000', 0],
['111100', 0]]],
['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['regression: scenario 1',
[3,
[[False, 0],
[True, 1],
[True, 0],
[False, 0],
[False, 1],
[True, 0],
[True, 1],
[False, 0],
[True, 1],
[False, 1],
[True, 0],
[True, 1],
[False, 1],
[False, 1],
[True, 0]]],
[['000', 0],
['100', 0],
['100', 0],
['100', 0],
['100', 0],
['010', 0],
['010', 0],
['010', 0],
['101', 0],
['101', 0],
['010', 1],
['010', 1],
['010', 1],
['010', 1],
['001', 0]]],
['control: scenario 2',
[6,
[[True, 0],
[True, 0],
[False, 0],
[True, 0],
[False, 1],
[False, 0],
[True, 0],
[False, 1],
[True, 0],
[True, 1],
[True, 1],
[False, 0]]],
[['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0]]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: three stage track | [['100', 0], ['100', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0], ['000', 0]] | [['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]] | Failed |
| regression: clock held high | [['10', 0], ['10', 0], ['10', 0], ['10', 0], ['00', 0]] | [['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]] | Failed |
| control: single stage | [['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]] | [['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]] | Passed |
| regression: sensor changes on edge scan | [['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]] | [['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]] | Passed |
| regression: scenario 1 | [['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['100000', 0], ['100000', 0], ['100000', 0], ['100000', 0], ['100000', 0], ['100000', 0], ['100000', 0], ['100000', 0]] | [['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['100000', 0], ['100000', 0], ['100000', 0], ['100000', 0], ['110000', 0], ['110000', 0], ['110000', 0], ['110000', 0]] | Failed |
| regression: scenario 2 | [['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['10', 0], ['10', 0], ['00', 0]] | [['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['10', 0], ['10', 0], ['01', 0]] | Failed |
| regression: scenario 3 | [['00000', 0], ['00000', 0], ['00000', 0], ['10000', 0], ['10000', 0], ['10000', 0], ['00000', 0], ['00000', 0], ['00000', 0], ['00000', 0], ['00000', 0]] | [['00000', 0], ['00000', 0], ['00000', 0], ['10000', 0], ['10000', 0], ['10000', 0], ['01000', 0], ['01000', 0], ['01000', 0], ['01000', 0], ['01000', 0]] | Failed |
| control: scenario 4 | [['0', 0], ['0', 0], ['0', 0], ['0', 0], ['1', 0], ['1', 0], ['1', 0], ['0', 1], ['0', 1], ['0', 1], ['0', 1], ['0', 0], ['0', 0], ['0', 0], ['0', 0], ['0', 0]] | [['0', 0], ['0', 0], ['0', 0], ['0', 0], ['1', 0], ['1', 0], ['1', 0], ['0', 1], ['0', 1], ['0', 1], ['0', 1], ['0', 0], ['0', 0], ['0', 0], ['0', 0], ['0', 0]] | Passed |
SHA-256 / 4f014beba2f2941530d239d3eee56213deec521aa238a158e4db210700275fe6
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(length, pulses):
bits = [0] * length
prev = False
unload = 0
out = []
for clock, sensor in pulses:
clock = bool(clock)
if clock and not prev:
unload = bits[length - 1]
bits = [1 if sensor else 0] + bits[:length - 1]
prev = clock
out.append([''.join(str(b) for b in bits), unload])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['regression: scenario 1',
[6,
[[True, 0],
[True, 0],
[False, 1],
[False, 0],
[True, 0],
[True, 0],
[False, 0],
[True, 1],
[False, 1],
[False, 1],
[False, 1],
[True, 1],
[True, 0],
[False, 1],
[False, 0]]],
[['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0]]],
['regression: scenario 2',
[2, [[False, 0], [False, 0], [False, 0], [False, 0], [False, 1], [True, 1], [False, 0], [True, 0]]],
[['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['10', 0], ['10', 0], ['01', 0]]],
['regression: scenario 3',
[5,
[[True, 0],
[True, 1],
[False, 0],
[True, 1],
[False, 0],
[False, 1],
[True, 0],
[True, 1],
[True, 0],
[True, 1],
[True, 0]]],
[['00000', 0],
['00000', 0],
['00000', 0],
['10000', 0],
['10000', 0],
['10000', 0],
['01000', 0],
['01000', 0],
['01000', 0],
['01000', 0],
['01000', 0]]],
['control: scenario 4',
[1,
[[False, 1],
[False, 1],
[True, 0],
[False, 1],
[True, 1],
[False, 0],
[False, 1],
[True, 0],
[True, 1],
[False, 0],
[False, 1],
[True, 0],
[False, 1],
[False, 1],
[True, 0],
[True, 0]]],
[['0', 0],
['0', 0],
['0', 0],
['0', 0],
['1', 0],
['1', 0],
['1', 0],
['0', 1],
['0', 1],
['0', 1],
['0', 1],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0]]]],
[['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['regression: scenario 4',
[2,
[[False, 0],
[True, 1],
[True, 1],
[True, 0],
[False, 0],
[False, 0],
[False, 1],
[True, 0],
[False, 0],
[True, 0]]],
[['00', 0],
['10', 0],
['10', 0],
['10', 0],
['10', 0],
['10', 0],
['10', 0],
['01', 0],
['01', 0],
['00', 1]]],
['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['control: scenario 1',
[2,
[[False, 1],
[False, 0],
[True, 0],
[False, 0],
[True, 0],
[True, 0],
[True, 0],
[True, 0],
[False, 0],
[False, 1],
[True, 0],
[True, 1],
[False, 1]]],
[['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0]]],
['control: scenario 2',
[2,
[[True, 0], [False, 1], [False, 1], [True, 0], [False, 1], [False, 0], [True, 0], [False, 1], [True, 0]]],
[['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0]]],
['control: scenario 3',
[1,
[[False, 1],
[False, 0],
[True, 0],
[True, 0],
[True, 1],
[False, 1],
[False, 0],
[False, 1],
[True, 1],
[False, 0],
[True, 0],
[True, 0],
[True, 1],
[False, 0],
[True, 1],
[False, 0]]],
[['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['0', 0],
['1', 0],
['1', 0],
['0', 1],
['0', 1],
['0', 1],
['0', 1],
['1', 0],
['1', 0]]]],
[['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['regression: scenario 1',
[4,
[[False, 0],
[False, 1],
[True, 1],
[True, 1],
[True, 1],
[True, 0],
[False, 1],
[True, 1],
[True, 0],
[False, 1],
[True, 1],
[True, 1]]],
[['0000', 0],
['0000', 0],
['1000', 0],
['1000', 0],
['1000', 0],
['1000', 0],
['1000', 0],
['1100', 0],
['1100', 0],
['1100', 0],
['1110', 0],
['1110', 0]]],
['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['control: scenario 2',
[1,
[[True, 0],
[False, 0],
[False, 1],
[True, 1],
[False, 0],
[False, 0],
[True, 1],
[True, 1],
[True, 1],
[True, 1],
[False, 1],
[True, 0]]],
[['0', 0],
['0', 0],
['0', 0],
['1', 0],
['1', 0],
['1', 0],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['0', 1]]],
['control: scenario 3',
[6, [[False, 1], [False, 0], [True, 0], [True, 1], [True, 0], [False, 0], [True, 0], [True, 0]]],
[['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0]]],
['regression: scenario 4',
[2,
[[False, 0],
[True, 0],
[True, 0],
[False, 0],
[True, 0],
[False, 0],
[True, 1],
[True, 0],
[True, 0],
[True, 0]]],
[['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['00', 0],
['10', 0],
['10', 0],
['10', 0],
['10', 0]]]],
[['regression: scenario 1',
[2, [[True, 0], [False, 1], [True, 0], [False, 0], [False, 1], [False, 1], [True, 1], [True, 1]]],
[['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['10', 0], ['10', 0]]],
['regression: scenario 3',
[3,
[[False, 1],
[False, 1],
[True, 0],
[False, 0],
[False, 0],
[True, 1],
[True, 1],
[True, 0],
[False, 0],
[True, 0],
[True, 1],
[False, 0]]],
[['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['100', 0],
['100', 0],
['100', 0],
['100', 0],
['010', 0],
['010', 0],
['010', 0]]],
['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['regression: scenario 2',
[3,
[[True, 0],
[False, 1],
[False, 0],
[True, 0],
[True, 1],
[False, 0],
[True, 0],
[False, 0],
[False, 0],
[True, 1],
[False, 1],
[False, 1],
[True, 0],
[False, 0],
[True, 1]]],
[['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['000', 0],
['100', 0],
['100', 0],
['100', 0],
['010', 0],
['010', 0],
['101', 0]]],
['control: scenario 4',
[1,
[[True, 1],
[False, 0],
[False, 0],
[True, 1],
[True, 1],
[False, 1],
[False, 1],
[False, 0],
[False, 1],
[True, 0],
[False, 1],
[False, 0],
[True, 0],
[False, 1]]],
[['1', 0],
['1', 0],
['1', 0],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['1', 1],
['0', 1],
['0', 1],
['0', 1],
['0', 0],
['0', 0]]]],
[['regression: scenario 5',
[6,
[[True, 0],
[True, 1],
[False, 0],
[False, 1],
[False, 0],
[False, 1],
[False, 0],
[False, 0],
[True, 1],
[True, 1],
[True, 1],
[False, 0],
[False, 1],
[False, 0],
[True, 0]]],
[['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['010000', 0]]],
['regression: scenario 7',
[6,
[[True, 1],
[False, 0],
[False, 1],
[False, 0],
[True, 1],
[True, 0],
[False, 0],
[False, 0],
[False, 1],
[False, 0],
[False, 0],
[True, 1],
[True, 0],
[False, 0],
[True, 1]]],
[['100000', 0],
['100000', 0],
['100000', 0],
['100000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['110000', 0],
['111000', 0],
['111000', 0],
['111000', 0],
['111100', 0]]],
['regression: three stage track',
[3, [[True, 1], [False, 0], [True, 0], [False, 0], [True, 1], [False, 0], [True, 0]]],
[['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]]],
['control: single stage',
[1, [[True, 1], [False, 0], [True, 0], [False, 1], [True, 1]]],
[['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]]],
['regression: clock held high',
[2, [[True, 1], [True, 0], [True, 1], [False, 0], [True, 0]]],
[['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]]],
['regression: sensor changes on edge scan',
[3, [[False, 1], [True, 0], [False, 0], [True, 1], [False, 0]]],
[['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]]],
['regression: scenario 1',
[3,
[[False, 0],
[True, 1],
[True, 0],
[False, 0],
[False, 1],
[True, 0],
[True, 1],
[False, 0],
[True, 1],
[False, 1],
[True, 0],
[True, 1],
[False, 1],
[False, 1],
[True, 0]]],
[['000', 0],
['100', 0],
['100', 0],
['100', 0],
['100', 0],
['010', 0],
['010', 0],
['010', 0],
['101', 0],
['101', 0],
['010', 1],
['010', 1],
['010', 1],
['010', 1],
['001', 0]]],
['control: scenario 2',
[6,
[[True, 0],
[True, 0],
[False, 0],
[True, 0],
[False, 1],
[False, 0],
[True, 0],
[False, 1],
[True, 0],
[True, 1],
[True, 1],
[False, 0]]],
[['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0],
['000000', 0]]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: three stage track | [['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]] | [['100', 0], ['100', 0], ['010', 0], ['010', 0], ['101', 0], ['101', 0], ['010', 1]] | Passed |
| regression: clock held high | [['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]] | [['10', 0], ['10', 0], ['10', 0], ['10', 0], ['01', 0]] | Passed |
| control: single stage | [['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]] | [['1', 0], ['1', 0], ['0', 1], ['0', 1], ['1', 0]] | Passed |
| regression: sensor changes on edge scan | [['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]] | [['000', 0], ['000', 0], ['000', 0], ['100', 0], ['100', 0]] | Passed |
| regression: scenario 1 | [['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['100000', 0], ['100000', 0], ['100000', 0], ['100000', 0], ['110000', 0], ['110000', 0], ['110000', 0], ['110000', 0]] | [['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['000000', 0], ['100000', 0], ['100000', 0], ['100000', 0], ['100000', 0], ['110000', 0], ['110000', 0], ['110000', 0], ['110000', 0]] | Passed |
| regression: scenario 2 | [['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['10', 0], ['10', 0], ['01', 0]] | [['00', 0], ['00', 0], ['00', 0], ['00', 0], ['00', 0], ['10', 0], ['10', 0], ['01', 0]] | Passed |
| regression: scenario 3 | [['00000', 0], ['00000', 0], ['00000', 0], ['10000', 0], ['10000', 0], ['10000', 0], ['01000', 0], ['01000', 0], ['01000', 0], ['01000', 0], ['01000', 0]] | [['00000', 0], ['00000', 0], ['00000', 0], ['10000', 0], ['10000', 0], ['10000', 0], ['01000', 0], ['01000', 0], ['01000', 0], ['01000', 0], ['01000', 0]] | Passed |
| control: scenario 4 | [['0', 0], ['0', 0], ['0', 0], ['0', 0], ['1', 0], ['1', 0], ['1', 0], ['0', 1], ['0', 1], ['0', 1], ['0', 1], ['0', 0], ['0', 0], ['0', 0], ['0', 0], ['0', 0]] | [['0', 0], ['0', 0], ['0', 0], ['0', 0], ['1', 0], ['1', 0], ['1', 0], ['0', 1], ['0', 1], ['0', 1], ['0', 1], ['0', 0], ['0', 0], ['0', 0], ['0', 0], ['0', 0]] | Passed |
SHA-256 / e9d35eff6214be3fd4c334d8267d985b696f385cb9b5670409145a873ab73ac4
Verification & scope
A deterministic bounded teaching model of one PLC instruction or rung pattern evaluated scan by scan. The stated contract is a stipulated toy convention, not a claim of conformance to any vendor controller or IEC 61131-3 runtime. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:51:42.539355+00:00.
Case digest / 0ba98fa4611679e5dea83f45b1edc9bad4fc4cb95e646b4cdddf0cf97882fd5d