Syscall 2: Firmware, home

ShuffleChapter 10: Meshes

S39TRAPDOOR

The task

The squares table, swapped about. Swap it back.

For each X from 1 to 5, P must receive X times X.

h passes X to t and the answer on to P. t works it out.

The board

The board of TRAPDOOR2 cores: h and t. Inputs X; outputs P.hSC-2 4 LINEStSC-1 8 LINESP0P1P2P0XP
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 7 swaps. Core h needs 1 operand swap; core t needs 2 instruction swaps and 4 operand swaps. 3 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

JRX A jumps ahead A lines, and only the lines from there down count.

Hint 2Show

From the bottom up: ADD 20 alone turns 5 into 25.

Hint 3Show

A 4 lands on SUB 8, and 4 minus 8 plus 20 is 16.

Solution

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

hSC-2 standard

IN P0
OUT P1
IN P2
OUT P1

tSC-1 lite

OUT 2
IN A
SUB 4
SUB 8
SUB 6
SUB 20
ADD P0
JRX P0

7 swaps back

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

  1. In core h, swap the operand P2 on line 3 with P1 on line 4.
  2. In core t, swap the operand 2 on line 1 with P0 on line 7.
  3. In core t, swap the operand 4 on line 3 with 2 on line 7.
  4. In core t, swap the operand 8 on line 4 with 4 on line 7.
  5. In core t, swap the operand 20 on line 6 with 8 on line 7.
  6. In core t, swap the instruction OUT on line 1 with IN on line 2.
  7. In core t, swap the instruction OUT on line 2 with JRX on line 8.

The finished program

Every tile back in place: the reference solution, which scores exactly par on every benchmark.

hSC-2 standard

IN P0
OUT P1
IN P1
OUT P2

tSC-1 lite

IN P0
JRX A
SUB 2
SUB 4
SUB 6
SUB 8
ADD 20
OUT P0
CYCLES
424
at par
ENERGY
1596
at par
NODES
2
at par
INSTRUCTIONS
12
at par
SWAPS
7
at par