S11KEPT COPY
The task
The program is here, with its pieces swapped. Put them back.
Every value from X must reach P doubled. MOV B, A keeps a copy of A.
The board
Key idea
Par is 2 swaps. Core a needs 2 operand swaps. One of them trades two tiles that hold each other's places; look for it 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
MOV B, A copies A into B without changing A. ADD B adds that copy.
Hint 2Show
IN replaces A, so the copy is taken after the read and before the add.
Hint 3Show
OUT sends A as it stands. The double has to be sitting in A by then.
Solution
Reveal the Full SolutionThe complete program for KEPT COPY. 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 A
MOV P0, B
ADD B
OUT P12 swaps back
Make these swaps in order. Lines are numbered from 1 in each core.
- In core
a, swap the operandAon line 1 withP0on line 2. - In core
a, swap the operandAon line 2 withBon 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
MOV B, A
ADD B
OUT P1- CYCLES
- 196
- at par
- ENERGY
- 936
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 4
- at par
- SWAPS
- 2
- at par