B72HICCUP
The task
P0 switches Q1, which runs current from the supply through R2 and the sense resistor R3.
P1 reads the sense voltage on CH1. The supply on CH2 surges now and then.
Keep Q1 on. If a tick of P2 reads over 40, turn it off for 5 ticks, then try again.
The board
- Sources
- V1 3 V and V2 3 V square at 25 Hz
- Resistors
- R1 1 kΩ, R2 47 Ω, and R3 47 Ω
- Transistors
- Q1, an NPN transistor
- Probes
- CH1 and CH2
Key idea
The sense voltage grows with the current: about 28 percent normally, near 58 in a surge.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
While Q1 is off no current flows, so the sense reads 0: count the off ticks, do not read.
Hint 2Show
Write 1, then loop: sleep, read, SUB 40, JL back. Over 40: write 0, sleep 5 ticks, start over.
Solution
Reveal the Full SolutionThe complete program for HICCUP. 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.
On until the sense passes 40, then 5 ticks off and retry.
u1SC-2 standard
ON: MOV A, 1
OUT P0
L: IN P2
IN P1
SUB 40
JL L
MOV A, 0
OUT P0
IN P2
IN P2
IN P2
IN P2
IN P2
JMP ON- CYCLES
- 288
- at par
- ENERGY
- 576
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 14
- at par