The Greenhouse Sprinkler
A sensor system manages the water flow. The SPRK output activates only when it is thirsty and not too sunny.
Replay this puzzle All puzzles
The truth table
Inputs on the left, outputs on the right. A circuit solves the puzzle when it reproduces every row.
| DRY | SUN | RAIN | SPRK | ALRT |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 1 | 0 |
| 1 | 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 |
What the table tells you
- SPRK is 1 in 3 of the 8 rows. Every input matters: for each one there is a row where flipping it changes SPRK. The rows that turn it on: DRY=1, SUN=0, RAIN=0; DRY=1, SUN=0, RAIN=1; DRY=1, SUN=1, RAIN=1.
- ALRT is 1 in 4 of the 8 rows, a balanced function, which is what XOR-like and single-input-like rules look like. It does not depend on DRY at all: flipping it never changes the output, so any gate reading it is wasted. The rows that turn it on: DRY=0, SUN=0, RAIN=0; DRY=0, SUN=1, RAIN=1; DRY=1, SUN=0, RAIN=0; DRY=1, SUN=1, RAIN=1.
The smallest known circuit: 4 gates
As a formula, one line per output:
SPRK = ((DRY AND NOT SUN) OR (DRY AND RAIN))ALRT = NOT (SUN XOR RAIN)
As a netlist, in the order you would wire it. Each g is one gate; the last lines say which signal drives each output.
g1 = NOT SUNg2 = RAIN OR g1g3 = RAIN XOR g1g4 = DRY AND g2SPRK = g4ALRT = g3
The search checked every circuit with fewer gates and none matches the table, so 4 is the true minimum for the allowed gate set. Gates that do not feed an output are never counted.
Leaderboard for the day
Nobody posted a result on the day. The circuit above is the reference.