S28SPOTLIGHT
The task
One LED at a time, and every piece of the program is out of place.
Sample P0 on each tick of P4 and light the one LED for the band it is in.
Green on P1 below 34 percent, yellow on P2 from 34, and red on P3 from 68.
The board
- Sources
- V1 2.5 V and V2 2.5 V triangle at 50 Hz
- Resistors
- R1 330 Ω, R2 330 Ω, and R3 330 Ω
- LEDs
- D1 green, D2 yellow, and D3 red
- Probes
- CH1, CH2, CH3, and CH4
Key idea
Par is 5 swaps. Core u1 needs 2 instruction swaps and 3 operand swaps. 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
DIV 34 turns the reading into its band: 0, 1, or 2.
Hint 2Show
MOD 2 is 1 only for the middle band, and DIV 2 is 1 only for the top one.
Hint 3Show
2 minus the band, divided by 2, is 1 only for the bottom band.
Solution
Reveal the Full SolutionThe complete program for SPOTLIGHT. 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 P4
IN P0
DIV B
MOV B, A
IN 2
OUT P2
MOV 2, 2
DIV B
MOD P3
MOV A, A
SUB 34
DIV 2
OUT P15 swaps back
Make these swaps in order. Lines are numbered from 1 in each core.
- In core
u1, swap the operandBon line 3 with34on line 11. - In core
u1, swap the operand2on line 7 withAon line 10. - In core
u1, swap the operand2on line 7 withBon line 8. - In core
u1, swap the instructionOUTon line 1 withINon line 5. - In core
u1, swap the instructionOUTon line 5 withMODon line 9.
The finished program
Every tile back in place: the reference solution, which scores exactly par on every benchmark.
u1SC-2 standard
IN P4
IN P0
DIV 34
MOV B, A
MOD 2
OUT P2
MOV A, B
DIV 2
OUT P3
MOV A, 2
SUB B
DIV 2
OUT P1- CYCLES
- 248
- at par
- ENERGY
- 496
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 13
- at par
- SWAPS
- 5
- at par