S12FLIP GATE
The task
A working program, swapped about. Restore each core.
Every value from X must reach P with its sign flipped.
The board
Key idea
Par is 2 swaps. Core a needs 1 operand swap; core b 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
NEG flips the sign of A. It belongs between the read and the write.
Hint 2Show
Core b only passes the value along: IN P0, then OUT P1.
Hint 3Show
Pieces swap inside one core. A line from b cannot land in a.
Solution
Reveal the Full SolutionThe complete program for FLIP GATE. 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-2 standard
IN P1
NEG
OUT P0bSC-2 standard
OUT P0
IN P12 swaps back
Make these swaps in order. Lines are numbered from 1 in each core.
- In core
a, swap the operandP1on line 1 withP0on line 3. - In core
b, swap the instructionOUTon line 1 withINon line 2.
The finished program
Every tile back in place: the reference solution, which scores exactly par on every benchmark.
aSC-2 standard
IN P0
NEG
OUT P1bSC-2 standard
IN P0
OUT P1- CYCLES
- 159
- at par
- ENERGY
- 1170
- at par
- NODES
- 2
- at par
- INSTRUCTIONS
- 5
- at par
- SWAPS
- 2
- at par