B11RAILROAD
The task
Two lamps share the chip. P0 drives the red lamp, P1 the amber lamp.
P2 ticks every 20 cycles. Sleep on it between changes.
Trade the lamps: red on and amber off, then the other way, and repeat.
The board
- Resistors
- R1 330 Ω and R2 330 Ω
- LEDs
- D1 red and D2 yellow
- Probes
- CH1 and CH2
Key idea
A digital output stays where you left it until the next OUT on that pin.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Light one lamp and put the other out before you sleep, or both glow together.
Hint 2Show
Sleep, set P0 to 1 and P1 to 0, sleep, then swap those two writes.
Solution
Reveal the Full SolutionThe complete program for RAILROAD. Open it only when you want the answer.
The reference program
The game's own solution. It passes every test and scores exactly par on every benchmark.
The lamps trade places each tick.
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