B62ZONES
The task
P0 reads the input on CH1 as a percent of the supply.
Light exactly one LED: P1 below 30 percent, P2 from 30 to 69, P3 from 70 up.
Sample the input on each tick of P4.
The board
- Sources
- V1 2.5 V triangle at 25 Hz and V2 2.5 V
- Resistors
- R1 330 Ω, R2 330 Ω, and R3 330 Ω
- LEDs
- D1 red, D2 green, and D3 yellow
- Probes
- CH1, CH2, CH3, and CH4
Key idea
Three zones of 40, 40, and the rest: adding 10 and dividing by 40 gives 0, 1, or 2.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
With the zone in B: zone DIV 2 lights P3, zone MOD 2 lights P2.
Hint 2Show
P1 is lit only in zone 0: 2 minus the zone, divided by 2, is 1 there and 0 elsewhere.
Solution
Reveal the Full SolutionThe complete program for ZONES. 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 zone of the reading picks one of three LEDs.
u1SC-2 standard
IN P4
IN P0
ADD 10
DIV 40
MOV B, A
MOD 2
OUT P2
MOV A, B
DIV 2
OUT P3
MOV A, B
NEG
ADD 2
DIV 2
OUT P1- CYCLES
- 586
- at par
- ENERGY
- 1172
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 15
- at par