Syscall 2: Firmware, home

SignalChapter 4: Stars and hubs

22SIGN SORTER

The task

Positive values from X go to P and negative ones to Q, in order.

Zeros go nowhere. The hub decides, the leaves deliver.

The board

The board of SIGN SORTER3 cores: h, c1, and c2. Inputs X; outputs P and Q.hSC-2 15 LINESc1SC-2 4 LINESc2SC-2 4 LINESP0P1P2P0P1P0P1XPQ
The board as the puzzle screen lays it out. Cyan pins read, lemon pins write, violet pins go both ways. On a narrow screen, scroll the board sideways to see all of it.

Key idea

Demultiplex by sign; zeros are dropped.

Hints

Each hint goes a step further than the one before. Open them one at a time.

Hint 1Show

JG and JL test the sign of A. A value that is neither is zero.

Hint 2Show

A hub that writes to one pin leaves the other leaf waiting, and that is fine.

Hint 3Show

A dropped value is simply never written.

Solution

Reveal the Full SolutionThe complete program for SIGN SORTER. Open it only when you want the answer.

The reference program

The game's own solution. It passes every test and scores exactly par on every benchmark.

hSC-2 standard

T: IN P0
JG G
JL N
JMP T
G: OUT P1
JMP T
N: OUT P2

c1SC-2 standard

IN P0
OUT P1

c2SC-2 standard

IN P0
OUT P1
CYCLES
198
at par
ENERGY
1388
at par
NODES
3
at par
INSTRUCTIONS
11
at par