Syscall 2: Firmware, home

ShuffleChapter 5: Half duplex

S17TALKBACK

The task

Two cores, their pieces swapped. Swaps stay inside a core.

P must receive each value from X doubled. Only the other core doubles it.

The board

The board of TALKBACK2 cores: c0 and c1. Inputs X; outputs P.c0SC-2 15 LINESc1SC-2 15 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 3 swaps. Core c0 needs 1 instruction swap and 1 operand swap; core c1 needs 1 instruction swap. Every one of them trades two tiles that hold each other's places, so each swap mends two.

Hints

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

Hint 1Show

c0 sends the value up its two way pin P1, then reads the reply on P1.

Hint 2Show

ADD A adds A to itself.

Hint 3Show

c1 answers on the same pin it read from.

Solution

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

IN P0
IN P1
OUT P2
OUT P1

c1SC-2 standard

OUT P0
ADD A
IN P0

3 swaps back

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

  1. In core c0, swap the operand P2 on line 3 with P1 on line 4.
  2. In core c0, swap the instruction IN on line 2 with OUT on line 3.
  3. In core c1, swap the instruction OUT on line 1 with IN on line 3.

The finished program

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

c0SC-2 standard

IN P0
OUT P1
IN P1
OUT P2

c1SC-2 standard

IN P0
ADD A
OUT P0
CYCLES
313
at par
ENERGY
1638
at par
NODES
2
at par
INSTRUCTIONS
7
at par
SWAPS
3
at par