S37DOG EAR
The task
The rectifier is all here, swapped about. Swap it back.
P0 reads a sine that swings either side of 50 percent.
Fold it: the duty on P1 is the distance from the middle, doubled.
The board
- Sources
- V1 2.5 V and V2 2 V sine at 50 Hz
- Resistors
- R1 1 kΩ
- Capacitors
- C1 1 µF
- Probes
- CH1 and CH2
Key idea
Par is 6 swaps. Core u1 needs 4 instruction swaps and 2 operand swaps. 2 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
SUB 50 measures from the middle. Below it, the result is negative.
Hint 2Show
JG skips the NEG when the distance is already positive.
Hint 3Show
MUL 2 doubles whatever reaches it, so it comes after the fold.
Solution
Reveal the Full SolutionThe complete program for DOG EAR. 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.
u1SC-2 standard
OUT 2
MUL 50
SUB P0
NEG
W: IN W
JG P16 swaps back
Make these swaps in order. Lines are numbered from 1 in each core.
- In core
u1, swap the operand2on line 1 withP0on line 3. - In core
u1, swap the operand2on line 3 withWon line 5. - In core
u1, swap the instructionOUTon line 1 withINon line 5. - In core
u1, swap the instructionMULon line 2 withSUBon line 3. - In core
u1, swap the instructionMULon line 3 withJGon line 6. - In core
u1, swap the instructionOUTon line 5 withMULon line 6.
The finished program
Every tile back in place: the reference solution, which scores exactly par on every benchmark.
u1SC-2 standard
IN P0
SUB 50
JG W
NEG
W: MUL 2
OUT P1- CYCLES
- 400
- at par
- ENERGY
- 800
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 6
- at par
- SWAPS
- 6
- at par