An algorithm for making a cup of coffee.
Input - 15 g · 250 g
Coffee and water, a ratio of about 1:16.7 Water - 93 °C
30 to 60 seconds after it boils Run time - 2:45–3:30
From the first pour until it has run through Output 1 cup And what to change next time
The three building blocks
Sequence The steps run in a fixed order. You grind before you pour, and you rinse the filter before the coffee goes in. Selection IF the water ran through before 2:45, THEN grind finer next time. IF it took longer than 3:30, grind coarser. Iteration WAIT UNTIL the dripper is empty: you check again and again until the condition is true.
The algorithm in 8 steps
- 1
Heat the water to 93 °C
Heat more water than you need, about 400 g: some of it goes into rinsing the filter. No thermometer? Start the bloom 30 to 60 seconds after it boils.
- 2
Weigh 15 g of coffee and grind it
While the water heats, grind medium-fine, about like table salt. Grind right before brewing: ground coffee loses its aroma within minutes.
- 3
Rinse the filter
Put a paper filter in the dripper, set it on the cup and pour hot water through. That removes the taste of paper and warms everything up. Pour the rinse water away.
- 4
Coffee in, scale to zero
Put the ground coffee in the filter, shake it level and set cup and dripper on the scale. Set the scale to zero.
- 5
Bloom: 45 g, then wait
Start the timer and pour 45 g of water, just enough to wet all the coffee. Swirl once. The coffee bubbles: that is CO₂ escaping. Wait until the timer shows 0:35.
- 6
Pour to 150 g, then to 250 g
Pour in slow spirals until the scale shows 150 g. At 1:15, pour on to 250 g. That is the whole water: 15 g of coffee to 250 g of water, a ratio of about 1:16.7.
- 7
Swirl, wait until it has run through
At 2:00, swirl the dripper once so the coffee bed lies flat. Then wait until no more water drips through.
- 8
Check the time, then taste
Read the timer. Done before 2:45? Grind finer next time. Took longer than 3:30? Grind coarser. Anything in between: drink it. In time but sour? Grind a little finer. Bitter and dry? A little coarser.
As pseudocode
INPUT coffee ← 15 g, water ← 250 g, temp ← 93 °C
boil(water)
grind(coffee, "medium-fine")
rinse(filter); add(coffee); scale ← 0
WAIT 30–60 s after boil // about 93 °C
start(timer)
pour(45 g); swirl()
WAIT UNTIL timer = 0:35
pour() UNTIL scale = 150 g
WAIT UNTIL timer = 1:15
pour() UNTIL scale = 250 g
WAIT UNTIL timer = 2:00
swirl()
WAIT UNTIL dripper is empty
IF timer < 2:45 THEN next.grind ← finer
ELSE IF timer > 3:30 THEN next.grind ← coarser
END IF
OUTPUT cup // taste it
As a flowchart
The short version for homework
Fill the kettle with water and switch it on. Put a paper filter in the dripper and ground coffee in the filter. Wait until the water boils, then let it stand for 30 seconds. Pour the water over the coffee and wait until it has run through. If you take milk, add milk. If you take sugar, add sugar and stir until it has dissolved. Serve the coffee.