Syscall 2: Firmware, home

SignalChapter 6: Trees

44ODD ONE OUT

The task

Three of X, Y, Z, and W always match, and one does not.

P must receive which one is different: 0 for X, 1 for Y, 2 for Z, or 3 for W.

The board

The board of ODD ONE OUT3 cores: h1, j, and h2. Inputs W, X, Y, and Z; outputs P.h1SC-2 15 LINESjSC-2 15 LINESh2SC-2 4 LINESP0P1P2P0P1P2P0P1P2XYZWP
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 decision tree on two differences; W is never needed.

Hints

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

Hint 1Show

If X and Y match, the odd one is Z or W.

Hint 2Show

If X and Y differ, one of them is odd, and Z matches the other.

Hint 3Show

You may not need every stream.

Solution

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

h1SC-2 standard

IN P1
MOV B, A
IN P0
OUT P2
SUB B
JZ M
MOV A, -2
M: ADD 2
OUT P2

h2SC-2 standard

IN P0
OUT P2

jSC-2 standard

IN P1
MOV B, A
IN P0
SUB B
JZ E
IN P0
JMP F
E: IN P0
ADD 1
F: OUT P2
CYCLES
455
at par
ENERGY
4334
at par
NODES
3
at par
INSTRUCTIONS
21
at par