S34SAY AGAIN
The task
Both ends of a lossy line, swapped about. Swaps stay inside a core.
P must receive a copy of X, from 1 to 99.
The locked line turns every third value it carries into a 0.
The board
Key idea
Par is 6 swaps. Core tx needs 2 instruction swaps and 1 operand swap; core rx needs 2 instruction swaps and 1 operand swap. 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
rx tells a lost value by its 0 and answers tx with whatever it got.
Hint 2Show
tx keeps the value in B and sends it again while the answer is 0.
Hint 3Show
rx passes a value on to P only once it is not 0.
Solution
Reveal the Full SolutionThe complete program for SAY AGAIN. 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.
txSC-2 standard
IN P0
MOV B, A
R: MOV P2, B
JZ P1
OUT A
IN RrxSC-2 standard
S: OUT P2
OUT P0
IN S
JZ P16 swaps back
Make these swaps in order. Lines are numbered from 1 in each core.
- In core
tx, swap the operandP2on line 3 withAon line 5. - In core
tx, swap the instructionJZon line 4 withOUTon line 5. - In core
tx, swap the instructionJZon line 5 withINon line 6. - In core
rx, swap the operandP2on line 1 withP0on line 2. - In core
rx, swap the instructionOUTon line 1 withINon line 3. - In core
rx, swap the instructionOUTon line 3 withJZon line 4.
The finished program
Every tile back in place: the reference solution, which scores exactly par on every benchmark.
txSC-2 standard
IN P0
MOV B, A
R: MOV A, B
OUT P1
IN P2
JZ RrxSC-2 standard
S: IN P0
OUT P2
JZ S
OUT P1- CYCLES
- 809
- at par
- ENERGY
- 3180
- at par
- NODES
- 2
- at par
- INSTRUCTIONS
- 10
- at par
- SWAPS
- 6
- at par