GrowDAY 038

Chapter 03 · 5 min read

Rain grows, sun ripens

Six conditions, a stream that widens, ice, snowmen and storms that fell trees – the rules of nature.

Nature takes its turn before the gardener does. The weather engine is a small, pure function: it takes yesterday's weather and the garden, and returns the next garden plus a few sentences about what happened. It is deterministic – replaying the log always produces exactly the garden in world.json, and npm run world:check proves it on every pull request.

Six conditions, checked in order

Open-Meteo reports daily values: rain, snow, sunshine hours, the night minimum, gusts. The engine reduces them to one condition – the first rule that matches wins:

ConditionWhat it does
StormGusts of 62 km/h or more blow away blossoms and fruit. A grown tree may fall (at most one every 60 days) – otherwise a paper boat strands on the sand bank.
SnowFrom 0.5 cm of fresh snow the garden turns white. Snowmen become possible; they melt with the snow.
FrostA night below 0 °C stops all growth, freezes the stream and makes the annual flowers wilt. Nothing can be planted in frozen ground.
RainFrom 1 mm every plant in its growing season grows one stage – two from 10 mm – and the stream rises.
Sun6 hours of sunshine on a dry day open blossoms and ripen fruit. The stream sinks and the sand bank grows.
GreyA grey day without enough rain or sun: nothing grows, nothing breaks. A good day to water.

In the year before the garden was planted, Heilbronn had 162 sunny days, 89 rain days, 53 nights of frost, 16 snow days and 12 storms. That mix is what the simulated year on the home page grew under.

The stream widens, the sand banks grow

The stream runs through a trough near the east end of the garden. Its level goes from 0 (a dry bed) to 8 (brimming): rain raises it, sun lowers it. Because the trough is curved, a higher level is also a wider stream – and when the water sinks, sand banks appear on both sides. Frost freezes it; the ice melts on the first day above 5 °C.

Storms and the paper boat

A storm blows away every blossom and every apple. If a tree is grown enough (45 % of its full size), the tallest one falls – at most one every 60 days. The fallen log stays in the garden: mushrooms can grow near it, and the gardener can build a bridge from it. No tree to fell? Then the storm strands a paper boat on the sand bank, and the next heavy rain carries it away.

GROW (SIMULATION) – Day 330: Harvest: 3 apples Carried inside in a basket, the best one eaten on the way. Weather: Sun, sun 13.1 h.
Day 330 of the simulated year – real Heilbronn weather, grown by the rule-based director.

The plants and their rules

Every plant has planting months, a growing season, a place it likes and neighbours it needs – or avoids. Lavender needs full sun, ferns need shade, mushrooms need wood. All of it is enforced in code, and RULES.md is generated from the same tables:

PlantRules
oakplanted Mar–Apr, Oct–Nov on the meadow or the stream bank; grows on rain in Mar–Oct; fully grown at stage 110; 6 columns from other trees and 4 from the garden's edge.
birchplanted Mar–Apr, Oct–Nov on the meadow or the stream bank; grows on rain in Mar–Oct; fully grown at stage 90; 5 columns from other trees and 4 from the garden's edge.
pineplanted Mar–Apr, Sep–Nov on the meadow; grows on rain all year; fully grown at stage 100; 5 columns from other trees and 4 from the garden's edge.
apple treeplanted Mar–Apr, Oct–Nov on the meadow; grows on rain in Mar–Oct; fully grown at stage 80; 6 columns from other trees and 4 from the garden's edge; blooms in the sun Apr–May from stage 24; apples ripen in the sun Aug–Oct.
willowplanted Mar–May, Oct–Nov on the stream bank; grows on rain in Mar–Oct; fully grown at stage 90; 6 columns from other trees and 4 from the garden's edge.
lavenderplanted Apr–Jun, Sep on the meadow; grows on rain in Apr–Sep; fully grown at stage 12; 2 columns from other shrubs; needs full sun – no grown tree within three columns; blooms in the sun Jun–Aug from stage 5.
fernplanted Mar–May, Sep–Oct on the meadow or the stream bank; grows on rain in Apr–Sep; fully grown at stage 10; 2 columns from other shrubs; needs shade – a tree of stage 16 or more within four columns.
reedplanted Mar–Sep on the sand bank or the stream bank; grows on rain in Apr–Sep; fully grown at stage 12; blooms in the sun Jul–Oct from stage 6.
sunflowerplanted Apr–Jul on the meadow or the stream bank; grows on rain in Apr–Oct; fully grown at stage 14; needs full sun – no grown tree within three columns; blooms in the sun Jul–Sep from stage 9; seed heads ripen in the sun Sep–Oct; wilts at the first frost.
poppyplanted Mar–May, Sep–Oct on the meadow or the stream bank; grows on rain in Mar–Oct; fully grown at stage 7; blooms in the sun May–Jul from stage 4; wilts at the first frost.
tulipplanted Sep–Nov on the meadow or the stream bank; grows on rain in Feb–May; fully grown at stage 7; blooms in the sun Apr–May from stage 5.
water lilyplanted Apr–Aug on the stream (at least half a unit deep); grows on rain in May–Sep; fully grown at stage 8; blooms in the sun Jun–Aug from stage 4; at most 4.
mushroomplanted Sep–Nov on the meadow or the stream bank; grows on rain in Sep–Nov; fully grown at stage 4; needs wood – a fallen log or a tree of stage 24 or more within three columns; at most 6.