Syscall 2: Firmware, home

SignalChapter 4: Stars and hubs

20BROADCAST

The task

Send each X value three ways: times 3 to P, negated to Q, and minus 10 to R.

Only the hub can read X.

The board

The board of BROADCAST3 cores: h, c1, and c2. Inputs X; outputs P, Q, and R.hSC-2 15 LINESc1SC-2 15 LINESc2SC-2 15 LINESP0P1P2P3P0P1P0P1XRPQ
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

One value, three uses; the leaf that triples needs two copies.

Hints

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

Hint 1Show

A hub can write the same A to as many pins as it likes.

Hint 2Show

ADD A doubles a value, but a third copy has to come from somewhere.

Hint 3Show

MOV B, A keeps a copy in B, and ADD B can add it as often as you like.

Solution

Reveal the Full SolutionThe complete program for BROADCAST. 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 P1
OUT P2
SUB 10
OUT P3

c1SC-2 standard

IN P0
MOV B, A
ADD B
ADD B
OUT P1

c2SC-2 standard

IN P0
NEG
OUT P1
CYCLES
313
at par
ENERGY
3042
at par
NODES
3
at par
INSTRUCTIONS
13
at par

Another way: Three reads

A second program that also passes, by a different road, at a cost on CYCLES, ENERGY, and INSTRUCTIONS.

Three copies, each added in turn.

hSC-2 standard

IN P0
OUT P1
OUT P1
OUT P1
OUT P2
SUB 10
OUT P3

c1SC-2 standard

IN P0
MOV B, A
IN P0
ADD B
MOV B, A
IN P0
ADD B
OUT P1

c2SC-2 standard

IN P0
NEG
OUT P1
CYCLES
508
over par
ENERGY
4212
over par
NODES
3
at par
INSTRUCTIONS
18
over par