S18SEESAW
The task
The railroad lamps, their code swapped about. Swap it back.
Trade the lamps on each tick of P2: red on P0 lit and amber on P1 dark, then the reverse.
The board
- Resistors
- R1 330 Ω and R2 330 Ω
- LEDs
- D1 red and D2 yellow
- Probes
- CH1 and CH2
Key idea
Par is 3 swaps. Core u1 needs 1 instruction swap 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
A digital output stays where you left it until the next OUT on that pin.
Hint 2Show
Light one lamp and put the other out before you sleep again.
Hint 3Show
Each MOV sets the value that the OUT after it writes.
Solution
Reveal the Full SolutionThe complete program for SEESAW. 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, 1
OUT P1
MOV A, 0
IN P2
OUT P0
MOV A, 0
OUT P0
MOV A, 1
OUT P13 swaps back
Make these swaps in order. Lines are numbered from 1 in each core.
- In core
u1, swap the operandP1on line 3 withP0on line 6. - In core
u1, swap the operandP2on line 5 withP1on line 6. - In core
u1, swap the instructionINon line 5 withOUTon line 6.
The finished program
Every tile back in place: the reference solution, which scores exactly par on every benchmark.
u1SC-2 standard
IN P2
MOV A, 1
OUT P0
MOV A, 0
OUT P1
IN P2
MOV A, 0
OUT P0
MOV A, 1
OUT P1- CYCLES
- 46
- at par
- ENERGY
- 92
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 10
- at par
- SWAPS
- 3
- at par