Syscall 2: Firmware, home

SignalChapter 11: Capstones

81CLOCK

The task

X is a time in minutes, from 0 to 240.

P must receive the whole hours in it, and Q the minutes left over.

a is an SC-1, a lite core: no B, half the energy, and MUL, DIV, and MOD take it 4 cycles.

The board

The board of CLOCK2 cores: a and b. Inputs X; outputs P and Q.aSC-1 5 LINESbSC-2 15 LINESP0P1P0P1P2XPQ
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

DIV and MOD: hours and minutes from one number. The SC-1 divides in 4 cycles at half the energy, so which core divides trades cycles for energy.

Hints

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

Hint 1Show

New here: DIV divides A, and MOD keeps what is left over, the remainder.

Hint 2Show

Once a divides, X is gone from a, so send X on to b before that.

Hint 3Show

b can work out Q while a is still dividing for P.

Solution

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

aSC-1 lite

IN P0
OUT P1
DIV 60
OUT P1

bSC-2 standard

IN P0
MOD 60
OUT P2
IN P0
OUT P1
CYCLES
354
at par
ENERGY
1638
at par
NODES
2
at par
INSTRUCTIONS
9
at par

Another way: Send twice

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

A only relays, sending X twice, and the standard core b does both divisions. One cycle a value faster than par, for more energy.

aSC-1 lite

IN P0
OUT P1
OUT P1

bSC-2 standard

IN P0
DIV 60
OUT P1
IN P0
MOD 60
OUT P2
CYCLES
315
under par
ENERGY
1755
over par
NODES
2
at par
INSTRUCTIONS
9
at par