WORM Solution
PEAK FILTER
WORM row 8

Prerequisites
Unlocks
w39 solved
Active cores1, 4, 5, 7, 8
Program lines30
DetailWORM row 8
Walkthrough
PEAK FILTER: sliding window of 3, emit window max (13 in -> 13 out).
Two chained window-2 maxes: A[k]=max(in[k-1],in[k]), out[k]=max(A[k-1],A[k]).
Missing samples primed to -999 so the growing-window edges fall out of the
same formula. Each stage = a DELAY core (emits prev,cur,cur) feeding a MAX core
(reads a,b,b -> b+ReLU(a-b)=max). MAX loops via PC-wrap (no JMP). Path 0->4->5->9->8.
Rack Solution
# PEAK FILTER: sliding window of 3, emit window max (13 in -> 13 out).
# Two chained window-2 maxes: A[k]=max(in[k-1],in[k]), out[k]=max(A[k-1],A[k]).
# Missing samples primed to -999 so the growing-window edges fall out of the
# same formula. Each stage = a DELAY core (emits prev,cur,cur) feeding a MAX core
# (reads a,b,b -> b+ReLU(a-b)=max). MAX loops via PC-wrap (no JMP). Path 0->4->5->9->8.
@1
MOV ACC, -999
L: MOV DOWN, ACC
MOV ACC, UP
MOV DOWN, ACC
MOV DOWN, ACC
JMP L
@4
MOV ACC, UP
SUB UP
JG P
MOV ACC, 0
P: ADD UP
MOV RIGHT, ACC
@5
MOV ACC, -999
L: MOV DOWN, ACC
MOV ACC, LEFT
MOV DOWN, ACC
MOV DOWN, ACC
JMP L
@8
MOV ACC, UP
SUB UP
JG P
MOV ACC, 0
P: ADD UP
MOV LEFT, ACC
@7
MOV DOWN, RIGHT