B45SCANNER
The task
These LEDs hang from V1 and light when their pin pulls low: a pin at 0 lights its LED.
On each tick of P3, move the light one place, P0 to P1 to P2 and back, starting at P0.
The board
- Sources
- V1 5 V
- Resistors
- R1 330 Ω, R2 330 Ω, and R3 330 Ω
- LEDs
- D1 red, D2 red, and D3 red
- Probes
- CH1, CH2, and CH3
Key idea
Any value but 0 keeps an LED dark here, so write 0 only to the pin whose turn it is.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
With the place of the light in A, OUT P0, SUB 1, OUT P1, SUB 1, OUT P2 does the rest.
Hint 2Show
The place runs 0, 1, 2, 1. Count the ticks around 0 to 3, then fold 3 back to 1.
Solution
Reveal the Full SolutionThe complete program for SCANNER. 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.
One light runs back and forth on pins that sink.
u1SC-2 standard
IN P3
ADD 3
MOD 4
SUB 2
JL S
NEG
S: ADD 2
OUT P0
SUB 1
OUT P1
SUB 1
OUT P2- CYCLES
- 219
- at par
- ENERGY
- 438
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 12
- at par