S25OFFBEAT
The task
The quadrature blinker, swapped about. Swap it back.
Red on P0 and green on P1 each blink over four ticks of P2: on for two, off for two.
The green LED runs one tick behind the red one.
The board
- Resistors
- R1 330 Ω and R2 330 Ω
- LEDs
- D1 red and D2 green
- Probes
- CH1 and CH2
Key idea
Par is 5 swaps. Core u1 needs 3 instruction swaps and 2 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
IN P2 sleeps until the next tick and reads the count of ticks so far.
Hint 2Show
MOD 4 gives the phase, 0 to 3, and DIV 2 turns it into 0, 0, 1, 1.
Hint 3Show
ADD 3 before the MOD makes the second pattern one tick late.
Solution
Reveal the Full SolutionThe complete program for OFFBEAT. 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 P2
MOV A, A
OUT 4
DIV 2
DIV 3
MOV B, B
OUT P0
MOD 4
MOD 2
ADD P15 swaps back
Make these swaps in order. Lines are numbered from 1 in each core.
- In core
u1, swap the operandAon line 2 withBon line 6. - In core
u1, swap the operand3on line 5 withP0on line 7. - In core
u1, swap the instructionOUTon line 7 withADDon line 10. - In core
u1, swap the instructionOUTon line 3 withMODon line 9. - In core
u1, swap the instructionDIVon line 5 withOUTon line 9.
The finished program
Every tile back in place: the reference solution, which scores exactly par on every benchmark.
u1SC-2 standard
IN P2
MOV B, A
MOD 4
DIV 2
OUT P0
MOV A, B
ADD 3
MOD 4
DIV 2
OUT P1- CYCLES
- 231
- at par
- ENERGY
- 462
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 10
- at par
- SWAPS
- 5
- at par