Syscall 2: Firmware, home

SignalChapter 6: Trees

41UPSIDE DOWN

The task

Each locked core sends on the larger of the two values it gets.

P must receive the smallest of X, Y, and Z.

The board

The board of UPSIDE DOWN6 cores: la, lb, max1, lc, max2, and end. Locked: max1 and max2. Inputs X, Y, and Z; outputs P.laSC-2 15 LINESlbSC-2 15 LINESmax1LOCKEDIN P0MOV B, AIN P1SUB BJG KMOV A, 0K: ADD BOUT P2lcSC-2 15 LINESmax2LOCKEDIN P0MOV B, AIN P1SUB BJG KMOV A, 0K: ADD BOUT P2endSC-2 15 LINESP0P1P0P1P0P1P2P0P1P0P1P2P0P1XYZP
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

Locked max cores give the min if the signs are flipped on the way in and out.

Hints

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

Hint 1Show

The locked cores can only find a largest value.

Hint 2Show

The largest of some negatives is the negative of the smallest.

Hint 3Show

Flip the sign once on the way in and once on the way out.

Solution

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

laSC-2 standard

IN P0
NEG
OUT P1

lbSC-2 standard

IN P0
NEG
OUT P1

lcSC-2 standard

IN P0
NEG
OUT P1

endSC-2 standard

IN P0
NEG
OUT P1
CYCLES
363
at par
ENERGY
2808
at par
NODES
4
at par
INSTRUCTIONS
12
at par