Syscall 2: Firmware, home

ShuffleChapter 3: Chains and rings

S03JUMBLE

The task

The pieces are all here. Swap them until the program runs.

Only values greater than 0 may reach P. Drop zero and every negative value.

The board

The board of JUMBLE2 cores: c0 and c1. Inputs X; outputs P.c0SC-2 15 LINESc1SC-2 15 LINESP0P1P0P1XP
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 3 swaps. Core c0 needs 2 instruction swaps and 1 operand swap. 2 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

A jump takes a label, as in JG H. A label never goes where a pin belongs.

Hint 2Show

JG jumps when A is greater than 0. JMP always jumps.

Hint 3Show

If the value is not positive, jump back to the read before writing.

Solution

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

c0SC-2 standard

S: OUT P0
IN S
JMP H
H: JG P1

c1SC-2 standard

IN P0
OUT P1

3 swaps back

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

  1. In core c0, swap the operand S on line 2 with H on line 3.
  2. In core c0, swap the instruction OUT on line 1 with IN on line 2.
  3. In core c0, swap the instruction OUT on line 2 with JG on line 4.

The finished program

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

c0SC-2 standard

S: IN P0
JG H
JMP S
H: OUT P1

c1SC-2 standard

IN P0
OUT P1
CYCLES
137
at par
ENERGY
852
at par
NODES
2
at par
INSTRUCTIONS
6
at par
SWAPS
3
at par