A watercolor forest that burns and regrows into a power law, untuned.
This is the Drossel-Schwabl forest fire model on a 320 by 200 lattice. Each step bare ground sprouts a tree with probability p, lightning strikes each tree with a far smaller probability f, and fire spreads to the four neighbors of every burning cell before it burns out. Nobody tunes it to a critical point, yet the forest organizes itself into stands of every age, and the number of fires that burn s trees falls off as a power law up to a cutoff set by p/f; the inset bins every fire started by the model's own random lightning logarithmically and fits the slope live. The painting is driven by the model: the time since each patch last burned sets a banded wash of char, ash, straw, meadow and deepening greens, sampled through a noise warp so edges wobble, with pigment pooling at band edges, trees stippled on top and a paper grain multiplied over it all.
Try it. Click to strike lightning (only dense old forest burns big). Drag to cut firebreaks, and right-drag or Shift-drag to erase them. Up and down arrows change the lightning rate and so the p/f cutoff, Space calls a lightning storm, and R regrows the landscape. Left alone, an occasional extra strike finds a dense old stand so big fires stay on show (those fires are left out of the statistics).
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build the Drossel-Schwabl forest fire model with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
Start simple:
- Make a canvas that fills the window and stays sharp on high-DPI screens. Create a grid of about 250 x 160 cells in a Uint8Array, where each cell is empty, a tree, or burning.
- Each step: every burning cell becomes empty and sets its four neighboring trees on fire; every empty cell grows a tree with a small probability p (try 0.003); every tree is struck by lightning with a much smaller probability f (try p / 1000).
- Keep the burning cells in a list so spreading the fire is fast, and run about 60 steps a second.
- Draw the grid into an ImageData at one pixel per cell (empty brown, trees green, fire orange) and scale it up to the canvas.
- Give each fire an id, count the trees it burns, and when it dies out add its size to a histogram with logarithmic bins (for example 5 bins per factor of ten).
Once that works, make it beautiful:
- Track each cell's age and the time since it last burned. Color burned ground from charcoal to ash to straw to meadow, and trees from pale saplings to dark old forest, so the landscape becomes a patchwork of stands of different ages.
- Soften it like a watercolor: draw a blurred, color-banded layer for the patches, a few darker pixels at band edges, and multiply a generated paper texture on top.
- Plot the fire size histogram on log-log axes in a corner and fit a straight line to show the power law.
- Let a click strike lightning at the pointer and a drag paint firebreaks that trees can never grow on.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as wind that biases the spread, terrain that slows fire uphill, or comparing the measured slope across different values of p / f.