Syscall 2: Firmware, home

SignalChapter 8: Scarcity

63RECTIFIER

The task

P must receive a copy of X, which runs from -99 to 99.

The locked core lim lets only 0 to 99 through. Lower values come out as 0.

enc, lim, and dec are SC-1s: register A only, 8 lines.

The board

The board of RECTIFIER3 cores: enc, lim, and dec. Locked: lim. Inputs X; outputs P.encSC-1 8 LINESlimLOCKEDIN P0JG OMOV A, 0O: OUT P1decSC-1 8 LINESP0P1P0P1P0P1XP
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

A locked core's limit carries a message: what it turns into 0 is a mark.

Hints

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

Hint 1Show

A locked core's limit can carry a message: whatever lim turns into 0 is a mark.

Hint 2Show

Send a value below 1 as itself, then as its opposite. lim turns the first one into 0.

Hint 3Show

dec passes a value above 0 straight on. After a 0 it reads one more and negates it.

Solution

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

encSC-1 lite

S: IN P0
OUT P1
JG S
NEG
OUT P1

decSC-1 lite

S: IN P0
JG K
IN P0
NEG
K: OUT P1
CYCLES
297
at par
ENERGY
962
at par
NODES
2
at par
INSTRUCTIONS
10
at par

Another way: Always two

A second program that also passes, by a different road, at a cost on CYCLES, ENERGY, and INSTRUCTIONS.

Every value goes out twice, as itself and negated, so lim always sends one 0. It passes, but it moves twice the values par does.

encSC-1 lite

IN P0
OUT P1
NEG
OUT P1

decSC-1 lite

S: IN P0
JG K
IN P0
NEG
OUT P1
JMP S
K: OUT P1
IN P0
CYCLES
364
over par
ENERGY
1063
over par
NODES
2
at par
INSTRUCTIONS
12
over par