Syscall 2: Firmware, home

SignalChapter 3: Chains and rings

16RING BUFFER

The task

P must receive each value from X minus the one three places before it.

Count 0 before the start. The cores form a one way ring, and what you send comes back.

The board

The board of RING BUFFER4 cores: c0, c1, c2, and c3. Inputs X; outputs P.c0SC-2 15 LINESc1SC-2 15 LINESc2SC-2 15 LINESc3SC-2 15 LINESP0P1P2P3P0P1P0P1P0P1XP
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 ring of one way links; one core must read first or the ring deadlocks.

Hints

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

Hint 1Show

Each core on the ring can hold one value and pass on the one it held.

Hint 2Show

If every core on a ring sends first, all of them wait for a reader. One must read first.

Hint 3Show

Send the new value around, then subtract what comes back.

Solution

Reveal the Full SolutionThe complete program for RING BUFFER. 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 P2
MOV B, A
IN P3
SUB B
NEG
OUT P1

c1SC-2 standard

IN P0
XCH A, B
OUT P1

c2SC-2 standard

IN P0
XCH A, B
OUT P1

c3SC-2 standard

IN P0
XCH A, B
OUT P1
CYCLES
625
at par
ENERGY
3744
at par
NODES
4
at par
INSTRUCTIONS
16
at par