S15LOOSE BULB
The task
The blink program is all here, swapped about. Put it back.
Blink the LED on P0: on for one tick of P1, off for the next.
The board
- Resistors
- R1 330 Ω
- LEDs
- D1 red
- Probes
- CH1
Key idea
Par is 3 swaps. Core u1 needs 1 instruction swap and 2 operand swaps. 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
IN P1 sleeps until the timer ticks. Each change waits for a tick of its own.
Hint 2Show
MOV A, 1 then OUT P0 lights the LED. MOV A, 0 then OUT P0 puts it out.
Hint 3Show
Each swap compiles at once, and the circuit runs whatever you have.
Solution
Reveal the Full SolutionThe complete program for LOOSE BULB. 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
IN P1
MOV A, 0
IN P1
OUT P0
MOV A, 1
OUT P03 swaps back
Make these swaps in order. Lines are numbered from 1 in each core.
- In core
u1, swap the operand0on line 2 with1on line 5. - In core
u1, swap the operandP1on line 3 withP0on line 4. - In core
u1, swap the instructionINon line 3 withOUTon line 4.
The finished program
Every tile back in place: the reference solution, which scores exactly par on every benchmark.
u1SC-2 standard
IN P1
MOV A, 1
OUT P0
IN P1
MOV A, 0
OUT P0- CYCLES
- 28
- at par
- ENERGY
- 56
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 6
- at par
- SWAPS
- 3
- at par