Adrian . Matías Quezada

Lulas (cell simulation)

A simulation of cells hunting each other, on a map that wraps around at every edge.

There are three kinds of thing in it. Plants are dark green circles that just grow — they are the only thing that puts energy into the world. Herbivores are light green circles with a stick coming out of them: the stick points where the cell is going, and its length is how fast, so you read speed off the drawing instead of a number. Hunters are the same, in red, and they chase herbivores.

Two things decide whether one cell eats another: what it is, and how big it is. Herbivores eat plants, hunters eat herbivores, and you can only eat something strictly smaller than yourself — equal sizes just bump into each other and drift apart. Fear works off exactly the same rule, so a big fat herbivore frightens nobody: it can't eat anyone. Eating is not instant either — the area transfers over several ticks, so you can watch a cell sitting on its meal.

Moving costs energy, and moving fast costs more. Cells shrink a little on every tick they travel, which means a herbivore with no plants around slowly starves to nothing, and a hunter that keeps missing does too.

When a cell gets big enough it splits in two, and the halves shoot off in opposite directions. Each child gets half the parent's radius, which is only a quarter of its area — so half the mass is simply lost in the split. That loss is the whole balance of the thing: plants feed energy in, splitting burns it off, and whether the population booms or starves falls out of those two numbers.

The second version of this project was rewritten from scratch to make flocking behaviour easier to implement, and eventually became a project of its own: Flocking.

Two of them are running

What you see above is the original, from 2014 — plain JavaScript, AMD modules loaded by RequireJS, and a white background. It was recovered from a branch in 2026 and it runs untouched at lulas.amatiasq.com/2014. Almost untouched: the commit it was recovered from is missing one file, ticker.js, which had been left uncommitted on my machine and went in later under a commit named "Missed file". Without it nothing starts at all. It is patched back in when the page is deployed, and the archived commit is kept exactly as it was.

The current one is a rewrite, from the same rules. It has what none of the old versions had: movement that costs energy, so things can actually starve; herbivores that run before they eat instead of after; solid bodies; and herds, borrowed from the flocking project. Same simulation, twelve years of my own opinions apart.