B24COINCIDENCE
The task
V1 and V2 send square waves to P0 and P1 at different rates.
Light the LED on P2 only while both inputs are high.
The board
- Sources
- V1 5 V square at 250 Hz and V2 5 V square at 100 Hz
- Resistors
- R1 330 Ω
- LEDs
- D1 green
- Probes
- CH1, CH2, and CH3
Key idea
When P0 reads 0 the answer is 0, whatever P1 says.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
JZ jumps when A is 0, so it can skip reading P1.
Hint 2Show
Read P0. If it is 0, write that 0. If not, read P1 and write what it says.
Solution
Reveal the Full SolutionThe complete program for COINCIDENCE. 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 LED lights only while both inputs are high.
u1SC-2 standard
IN P0
JZ W
IN P1
W: OUT P2- CYCLES
- 400
- at par
- ENERGY
- 800
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 4
- at par
Another way: Mul
A second program that also passes, by a different road, at a cost on INSTRUCTIONS.
The product of the two readings is 1 only when both are 1.
u1SC-2 standard
IN P0
MOV B, A
IN P1
MUL B
OUT P2- CYCLES
- 400
- at par
- ENERGY
- 800
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 5
- over par