WORM Solution

PEAK HOLD

WORM row 5

In-game screenshot of PEAK HOLD
In-game view
FamilyWORM Graph0.443 Difficulty0.443 Ring03 IDw25

Prerequisites

MIRROR BITS

Unlocks

CROSSWIRERUNNING FLOOR

Reference rack program w25 solved
Active cores1, 4, 7 Program lines16 DetailWORM row 5

Walkthrough

PEAK HOLD: running max, reset to 0 on a 0 input, emit after every input.

Forward-only pipeline: core 0 reads IN and pumps it twice DOWN to the peak

engine in core 4; core 4 holds the running peak in ACC and emits the new peak

DOWN to the output (core 8). Two copies of IN: copy 1 picks the winner branch

(peak-IN sign), copy 2 supplies the winning value and the 0-reset test.

Rack Solution
# PEAK HOLD: running max, reset to 0 on a 0 input, emit after every input.
# Forward-only pipeline: core 0 reads IN and pumps it twice DOWN to the peak
# engine in core 4; core 4 holds the running peak in ACC and emits the new peak
# DOWN to the output (core 8). Two copies of IN: copy 1 picks the winner branch
# (peak-IN sign), copy 2 supplies the winning value and the 0-reset test.
@1
MOV ACC, UP
MOV DOWN, ACC
MOV DOWN, ACC
@4
M: SAV
SUB UP
JG W
MOV ACC, UP
JMP E
W: MOV ACC, UP
JZ E
XCH
E: MOV DOWN, ACC
@7
MOV DOWN, UP