B63BROWNOUT
The task
P0 reads the supply on CH1 as a percent. P1 is the RUN line: high lets the system run.
Sample P0 on each tick of P2. Raise RUN only after 5 ticks in a row read 60 or more.
Any tick under 60 drops RUN at once and starts the count over.
The board
- Sources
- V1 0.5 V, V2 1.5 V square at 35.71 Hz, V3 1.5 V square at 50 Hz, and V4 1.5 V square at 19.23 Hz
- Resistors
- R1 330 Ω
- LEDs
- D1 green
- Probes
- CH1 and CH2
Key idea
Count good ticks in B. A bad tick clears B and writes 0.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Once B reaches 5, write 1. More good ticks only keep it high.
Hint 2Show
IN P2, IN P0, SUB 60, JL to the bad branch; else add 1 to B, and write 1 once B is 5 or more.
Solution
Reveal the Full SolutionThe complete program for BROWNOUT. 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.
A count of good ticks, cleared by any bad one.
u1SC-2 standard
L: IN P2
IN P0
SUB 60
JL BAD
MOV A, B
ADD 1
MOV B, A
SUB 5
JL L
MOV A, 1
OUT P1
JMP L
BAD: MOV A, 0
MOV B, A
OUT P1- CYCLES
- 663
- at par
- ENERGY
- 1326
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 15
- at par