Syscall 2: Firmware, home

SignalChapter 5: Half duplex

37SAFE CRACKER

The task

Send guesses to the judge. It answers -1 when a guess is low, 1 when high, and 0 when right.

P must receive each secret in turn. Secrets run from 0 to 99.

The board

The board of SAFE CRACKER3 cores: guess, judge, and vault. Locked: judge and vault. Inputs X; outputs P.guessSC-2 15 LINESjudgeLOCKEDT: IN P1MOV B, AIN P0SUB BJZ OJG HMOV A, -1JMP OH: MOV A, 1O: OUT P1OUT P0vaultLOCKEDS: IN P0L: OUT P1MOV B, AIN P1JZ SXCHJMP LP0P1P0P1P0P1XP
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

Search against a locked judge that answers low, high, or right; no outputs until a find.

Hints

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

Hint 1Show

Keep the guess in B while A reads the answer.

Hint 2Show

Big steps up, then single steps down, will find any secret.

Hint 3Show

After a find, the vault moves on to its next secret.

Solution

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

guessSC-2 standard

G: OUT P0
MOV B, A
IN P0
JZ F
JG DN
XCH A, B
ADD 10
JMP G
DN: XCH A, B
SUB 1
JMP G
F: XCH A, B
OUT P1
CYCLES
15035
at par
ENERGY
43036
at par
NODES
1
at par
INSTRUCTIONS
13
at par