Syscall 2: Firmware, home

ShuffleChapter 7: Frames and loops

S24SCATTERSHOT

The task

One hub feeds three answers, and every piece is out of place.

Send each X three ways: times 3 to P, negated to Q, and minus 10 to R.

The board

The board of SCATTERSHOT3 cores: h, c1, and c2. Inputs X; outputs P, Q, and R.hSC-2 15 LINESc1SC-2 15 LINESc2SC-2 15 LINESP0P1P2P3P0P1P0P1XRPQ
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 5 swaps. Core h 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

The hub can write one value to several pins before it changes it.

Hint 2Show

SUB 10 changes A, so it comes after the copies that need X as it was.

Hint 3Show

MOV B, A keeps a copy, and ADD B twice makes three of it.

Solution

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

OUT P2
OUT P3
IN P0
OUT P1
SUB 10

c1SC-2 standard

IN P0
MOV B, A
ADD B
ADD B
OUT P1

c2SC-2 standard

IN P0
NEG
OUT P1

5 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 1 with P0 on line 3.
  2. In core h, swap the operand P3 on line 2 with P1 on line 4.
  3. In core h, swap the operand P3 on line 4 with 10 on line 5.
  4. In core h, swap the instruction OUT on line 1 with IN on line 3.
  5. In core h, swap the instruction OUT on line 4 with SUB on line 5.

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
OUT P2
SUB 10
OUT P3

c1SC-2 standard

IN P0
MOV B, A
ADD B
ADD B
OUT P1

c2SC-2 standard

IN P0
NEG
OUT P1
CYCLES
313
at par
ENERGY
3042
at par
NODES
3
at par
INSTRUCTIONS
13
at par
SWAPS
5
at par