Syscall 2: Firmware, home

SignalChapter 8: Scarcity

65DETOUR

The task

P must receive 100 minus 8 times each X value.

A value can take the short road through k or the long road through l1, l2, and l3.

k is a standard core. s, j, l1, l2, and l3 are SC-1s: register A only, 8 lines.

The board

The board of DETOUR6 cores: s, k, j, l1, l2, and l3. Inputs X; outputs P.sSC-1 5 LINESkSC-2 15 LINESjSC-1 8 LINESl1SC-1 8 LINESl2SC-1 8 LINESl3SC-1 8 LINESP0P1P2P0P1P0P1P2P0P1P0P1P0P1XP
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 long road of cheap cores costs less energy and runs faster than a short road through one standard core, at more nodes.

Hints

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

Hint 1Show

A long road of cheap cores can cost less energy than a short road through one standard core.

Hint 2Show

One road takes fewer NODES. Both roads at once run in fewer CYCLES.

Hint 3Show

If s deals the roads in turn, j must collect them in the same turn.

Solution

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

sSC-1 lite

IN P0
OUT P2

l1SC-1 lite

IN P0
NEG
ADD A
OUT P1

l2SC-1 lite

IN P0
ADD A
ADD A
OUT P1

l3SC-1 lite

IN P0
ADD 100
OUT P1

jSC-1 lite

IN P1
OUT P2
CYCLES
207
at par
ENERGY
1755
at par
NODES
5
at par
INSTRUCTIONS
15
at par

Another way: Both roads

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

S deals the roads in turn and j collects in the same turn. Fewer CYCLES than par, at more energy, more NODES, and more INSTRUCTIONS.

sSC-1 lite

IN P0
OUT P1
IN P0
OUT P2

kSC-2 standard

IN P0
NEG
ADD A
ADD A
ADD A
OUT P1

l1SC-1 lite

IN P0
NEG
ADD A
OUT P1

l2SC-1 lite

IN P0
ADD A
ADD A
OUT P1

l3SC-1 lite

IN P0
ADD 100
OUT P1

jSC-1 lite

IN P0
ADD 100
OUT P2
IN P1
OUT P2
CYCLES
186
under par
ENERGY
1875
over par
NODES
6
over par
INSTRUCTIONS
26
over par

Another way: Short road

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

The short road. Fewer NODES and INSTRUCTIONS than par, but the work costs twice the energy on k and the one core sets the pace.

sSC-1 lite

IN P0
OUT P1

kSC-2 standard

IN P0
NEG
ADD A
ADD A
ADD A
ADD 100
OUT P1

jSC-1 lite

IN P0
OUT P2
CYCLES
317
over par
ENERGY
2106
over par
NODES
3
under par
INSTRUCTIONS
11
under par