Syscall 2: Firmware, home

ShuffleChapter 11: Capstones

S46LOST TIME

The task

The clock code, swapped about. Swap it back.

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

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

The board

The board of LOST TIME2 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

Par is 8 swaps. Core a needs 2 instruction swaps and 1 operand swap; core b needs 2 instruction swaps and 3 operand swaps. 4 of them trade two tiles that hold each other's places; look for those first, since one swap mends both.

Hints

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

Hint 1Show

DIV 60 gives the whole hours. MOD 60 keeps the minutes left over.

Hint 2Show

a sends X on to b before it divides, then sends the hours after it.

Hint 3Show

b reads twice: X for the minutes, then the hours to pass along.

Solution

Reveal the Full SolutionThe complete program for LOST TIME. Open it only when you want the answer.

The board as dealt

This is the arrangement the game deals. Framed tiles are the ones out of place.

aSC-1 lite

OUT P1
OUT P1
IN 60
DIV P0

bSC-2 standard

IN 60
OUT P1
IN P0
MOD P0
OUT P2

8 swaps back

Make these swaps in order. Lines are numbered from 1 in each core.

  1. In core a, swap the operand P1 on line 1 with P0 on line 4.
  2. In core a, swap the instruction OUT on line 1 with IN on line 3.
  3. In core a, swap the instruction OUT on line 3 with DIV on line 4.
  4. In core b, swap the operand 60 on line 1 with P0 on line 3.
  5. In core b, swap the operand P1 on line 2 with 60 on line 3.
  6. In core b, swap the operand P1 on line 3 with P2 on line 5.
  7. In core b, swap the instruction OUT on line 2 with MOD on line 4.
  8. In core b, swap the instruction IN on line 3 with OUT on line 4.

The finished program

Every tile back in place: the reference solution, which 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
SWAPS
8
at par