WORM Solution

CARRIER DETECT

WORM row 9

In-game screenshot of CARRIER DETECT
In-game view
FamilyWORM Graph0.817 Difficulty0.817 Ring05 IDw41

Prerequisites

Polynomial Serial

Unlocks

BREATHE

Reference rack program w41 solved
Active cores1, 2, 4, 7 Program lines26 DetailWORM row 9

Walkthrough

CARRIER DETECT: OUT[k]=1 iff in[k-2]<in[k-1]<in[k] (two consecutive ascents).

asc[k]=(in[k]>in[k-1]); OUT[k]=asc[k] AND asc[k-1]. Core 1 = delay (buffers old in

BAK while taking new). Core 0 reads in[k], sends it to core 1, reads back old prev,

emits ascent bit DOWN. Core 4 ANDs bit with previous bit (BAK), relays. Core 8 -> OUT0.

Rack Solution
# CARRIER DETECT: OUT[k]=1 iff in[k-2]<in[k-1]<in[k] (two consecutive ascents).
# asc[k]=(in[k]>in[k-1]); OUT[k]=asc[k] AND asc[k-1]. Core 1 = delay (buffers old in
# BAK while taking new). Core 0 reads in[k], sends it to core 1, reads back old prev,
# emits ascent bit DOWN. Core 4 ANDs bit with previous bit (BAK), relays. Core 8 -> OUT0.
@1
M: MOV ACC, UP
MOV RIGHT, ACC
SUB RIGHT
JG P
MOV DOWN, 0
JMP M
P: MOV DOWN, 1
@2
MOV ACC, 999
L: SAV
MOV ACC, LEFT
XCH
MOV LEFT, ACC
XCH
JMP L
@4
N: MOV ACC, UP
JZ Z
XCH
MOV DOWN, ACC
JMP N
Z: SAV
MOV DOWN, ACC
@7
MOV DOWN, UP