WORM Solution

FLOW CONTROL

WORM row 8

In-game screenshot of FLOW CONTROL
In-game view
FamilyWORM Graph0.759 Difficulty0.759 Ring05 IDw40

Prerequisites

DUAL COUNTER

Unlocks

Digest Lock

Reference rack program w40 solved
Active cores0, 1, 2, 3, 4, 6, 7, 8 Program lines26 DetailWORM row 8

Walkthrough

w40 FLOW CONTROL

Core 1 (B on UP) is the controller. ACC holds the running credit balance.

Each slot: ADD UP (balance += B[k]). It sends the balance to core 0 as the

forward flag (MOV LEFT, ACC: core 0 forwards A only when this is > 0). If the

balance is > 0 it consumes one credit (SUB 1); then it emits the post-consume

balance DOWN -> core 5 -> core 9 -> OUT stream 1 (every slot, 13 values). The

post-consume balance in ACC is exactly next slot's starting credits (carry).

Core 0 (A on UP) reads core 1's flag from RIGHT. Flag 0: read and drop this

slot's A (MOV ACC, UP) to stay aligned. Flag > 0: MOV DOWN, UP forwards this

slot's A down -> core 4 -> core 8 -> OUT stream 0.

Rack Solution
# w40 FLOW CONTROL
# Core 1 (B on UP) is the controller. ACC holds the running credit balance.
#   Each slot: ADD UP (balance += B[k]). It sends the balance to core 0 as the
#   forward flag (MOV LEFT, ACC: core 0 forwards A only when this is > 0). If the
#   balance is > 0 it consumes one credit (SUB 1); then it emits the post-consume
#   balance DOWN -> core 5 -> core 9 -> OUT stream 1 (every slot, 13 values). The
#   post-consume balance in ACC is exactly next slot's starting credits (carry).
# Core 0 (A on UP) reads core 1's flag from RIGHT. Flag 0: read and drop this
#   slot's A (MOV ACC, UP) to stay aligned. Flag > 0: MOV DOWN, UP forwards this
#   slot's A down -> core 4 -> core 8 -> OUT stream 0.
@1
L: ADD RIGHT
MOV LEFT, ACC
JG F
MOV DOWN, ACC
JMP L
F: SUB 1
MOV DOWN, ACC
@0
G: MOV ACC, RIGHT
JZ D
MOV DOWN, UP
JMP G
D: MOV ACC, UP
@3
MOV DOWN, UP
@6
MOV DOWN, UP
@4
MOV DOWN, UP
@7
MOV RIGHT, UP
@2
MOV LEFT, UP
@8
MOV DOWN, LEFT