Syscall 2: Firmware, home

SignalChapter 3: Chains and rings

17HIGH WATER

The task

P must receive the largest of each value from X and the two before it.

Count 0 before the start. The largest of three is the larger of two neighboring pairs.

The board

The board of HIGH WATER3 cores: c0, c1, and c2. Inputs X; outputs P.c0SC-2 15 LINESc1SC-2 15 LINESc2SC-2 15 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

The largest of the last 3, a moving window over two stages.

Hints

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

Hint 1Show

A core that sends the larger of each value and the one before it does half the job.

Hint 2Show

Do it twice in a row and you have the largest of three.

Hint 3Show

XCH keeps the new value in B for next time and puts the old one in A.

Solution

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

c0SC-2 standard

IN P0
OUT P1

c1SC-2 standard

IN P0
XCH A, B
SUB B
JG K
MOV A, 0
K: ADD B
OUT P1

c2SC-2 standard

IN P0
XCH A, B
SUB B
JG K
MOV A, 0
K: ADD B
OUT P1
CYCLES
318
at par
ENERGY
3556
at par
NODES
3
at par
INSTRUCTIONS
16
at par