Syscall 2: Firmware, home

SignalChapter 2: Workshop

9SORTED JOIN

The task

P must receive each value from X with its sign removed.

The locked router splits the stream and waits for your ready signal before each new value.

The board

The board of SORTED JOIN4 cores: router, c1, c2, and c3. Locked: router. Inputs X; outputs P.routerLOCKEDT: IN P0JG UOUT P2JMP KU: OUT P1K: IN P3c1SC-2 15 LINESc2SC-2 15 LINESc3SC-2 15 LINESP0P1P2P3P0P1P0P1P0P1P2P3XP
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

ANY reads from whichever branch is ready.

Hints

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

Hint 1Show

The router sends positive values up and everything else down.

Hint 2Show

The lower branch must flip the sign.

Hint 3Show

IN ANY takes from whichever branch has a value. Then OUT P3 tells the router you are ready.

Solution

Reveal the Full SolutionThe complete program for SORTED JOIN. 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.

c1SC-2 standard

IN P0
OUT P1

c2SC-2 standard

IN P0
NEG
OUT P1

c3SC-2 standard

IN ANY
OUT P2
OUT P3
CYCLES
415
at par
ENERGY
1292
at par
NODES
3
at par
INSTRUCTIONS
8
at par