WORM Solution

RUNNING FLOOR

WORM row 5

In-game screenshot of RUNNING FLOOR
In-game view
FamilyWORM Graph0.443 Difficulty0.443 Ring03 IDw54
Reference rack program w54 solved
Active cores1, 4 Program lines15 DetailWORM row 5

Walkthrough

RUNNING FLOOR: OUT = the smallest input seen so far (never resets).

Two-row rack: input tap rides core 1 (UP), output tap rides core 4 (DOWN).

Core 1 fans each input DOWN twice, the way the peak-hold pipeline does: the

compare consumes one copy, the chosen value needs the other.

Core 4 keeps the running floor in ACC, primed to +999 so the first input

always lowers it. Each step: BAK = floor, ACC = floor: v (first copy). If the

result is below 0 the floor is already smaller, so keep it (discard the second

copy and swap the floor back); otherwise the new value is the floor (take the

second copy). The loop wraps via JMP M, so the prime runs only once.

Rack Solution
# RUNNING FLOOR: OUT = the smallest input seen so far (never resets).
# Two-row rack: input tap rides core 1 (UP), output tap rides core 4 (DOWN).
# Core 1 fans each input DOWN twice, the way the peak-hold pipeline does: the
# compare consumes one copy, the chosen value needs the other.
# Core 4 keeps the running floor in ACC, primed to +999 so the first input
# always lowers it. Each step: BAK = floor, ACC = floor: v (first copy). If the
# result is below 0 the floor is already smaller, so keep it (discard the second
# copy and swap the floor back); otherwise the new value is the floor (take the
# second copy). The loop wraps via JMP M, so the prime runs only once.
@1
MOV ACC, UP
MOV DOWN, ACC
MOV DOWN, ACC
@4
MOV ACC, 999
M: SAV
SUB UP
JL K
MOV ACC, UP
JMP E
K: MOV NIL, UP
XCH
E: MOV DOWN, ACC
JMP M