S13BOTH HANDS
The task
The lines are shuffled. Swap them back into an order that runs.
P must receive X and Y added together. XCH A, B trades the two registers.
The board
Key idea
Par is 3 swaps. Core a needs 2 instruction swaps and 1 operand 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
XCH A, B swaps A and B. Both names are required.
Hint 2Show
Read X, park it with XCH A, B, read Y, then ADD B.
Hint 3Show
OUT is last. It sends whatever A holds at that moment.
Solution
Reveal the Full SolutionThe complete program for BOTH HANDS. 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
ADD B
XCH A, P0
OUT P1
IN B
IN P23 swaps back
Make these swaps in order. Lines are numbered from 1 in each core.
- In core
a, swap the operandBon line 1 withP0on line 2. - In core
a, swap the instructionADDon line 1 withINon line 4. - In core
a, swap the instructionOUTon line 3 withINon line 5.
The finished program
Every tile back in place: the reference solution, which scores exactly par on every benchmark.
aSC-2 standard
IN P0
XCH A, B
IN P1
ADD B
OUT P2- CYCLES
- 235
- at par
- ENERGY
- 1170
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 5
- at par
- SWAPS
- 3
- at par