Syscall 2: Firmware, home

SignalChapter 8: Scarcity

59GATE

The task

When Y is above 0, P must receive the next X. Otherwise Q must receive it.

g is an SC-1: register A only, 8 lines, no B or XCH.

The board

The board of GATE1 core: g. Inputs X and Y; outputs P and Q.gSC-1 8 LINESP0P1P2P3XYPQ
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

An SC-1 forgets A when it reads, so it reads the deciding value first and the jump remembers it.

Hints

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

Hint 1Show

An SC-1 forgets A when it reads, so read the value that decides first.

Hint 2Show

Read Y, jump on it, and only then read X. The jump remembers what Y said.

Hint 3Show

Every X goes somewhere, so both branches read it.

Solution

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

gSC-1 lite

S: IN P1
JG K
IN P0
OUT P3
JMP S
K: IN P0
OUT P2
CYCLES
221
at par
ENERGY
529
at par
NODES
1
at par
INSTRUCTIONS
7
at par