Syscall 2: Firmware, home

SignalChapter 4: Stars and hubs

25ROUND ROBIN

The task

P must receive 4 times each X value, plus 1, in order.

w1 is an SC-2L, a low power core: it takes 2 cycles an instruction but half the energy.

Collect results in the order you dealt them.

The board

The board of ROUND ROBIN4 cores: h, w1, w2, and j. Inputs X; outputs P.hSC-2 15 LINESw1SC-2L 6 LINESw2SC-2 6 LINESjSC-2 15 LINESP0P1P2P0P1P0P1P0P1P2XP
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

Deal values to two workers in turn and collect them in the same turn; w1 is a slow SC-2L, so it gets one turn in three.

Hints

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

Hint 1Show

Either worker can do the whole job. Par needs both.

Hint 2Show

The dealer and the collector must agree on whose turn it is.

Hint 3Show

w1 is slow, so give it fewer turns: two values to w2 for each one to w1.

Solution

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

hSC-2 standard

IN P0
OUT P2
IN P0
OUT P1
IN P0
OUT P2

w1SC-2L low power

IN P0
ADD A
ADD A
ADD 1
OUT P1

w2SC-2 standard

IN P0
ADD A
ADD A
ADD 1
OUT P1

jSC-2 standard

IN P1
OUT P2
IN P0
OUT P2
IN P1
OUT P2
CYCLES
213
at par
ENERGY
1911
at par
NODES
4
at par
INSTRUCTIONS
22
at par

Another way: Even turns

A second program that also passes. It beats par on ENERGY and INSTRUCTIONS and gives some back on CYCLES.

Strict turns: slower than par, since w1 holds up every other value, but it spends less energy.

hSC-2 standard

IN P0
OUT P1
IN P0
OUT P2

w1SC-2L low power

IN P0
ADD A
ADD A
ADD 1
OUT P1

w2SC-2 standard

IN P0
ADD A
ADD A
ADD 1
OUT P1

jSC-2 standard

IN P0
OUT P2
IN P1
OUT P2
CYCLES
224
over par
ENERGY
1806
under par
NODES
4
at par
INSTRUCTIONS
18
under par

Another way: One worker

A second program that also passes. It beats par on ENERGY, NODES, and INSTRUCTIONS and gives some back on CYCLES.

Correct but slow: every value through the first worker.

hSC-2 standard

IN P0
OUT P1

w1SC-2L low power

IN P0
ADD A
ADD A
ADD 1
OUT P1

jSC-2 standard

IN P0
OUT P2
CYCLES
433
over par
ENERGY
1521
under par
NODES
3
under par
INSTRUCTIONS
9
under par