HOW the leopard got his spots is, famously, the subject of one of Rudyard Kipling's “Just So Stories”. Kipling suggested they were handprints made by the leopard's human friend. More plausibly, he had an explanation for what the spots are for: to break up the animal's shape when it is hiding in the dappled light of the forest.

These days, the human-handprint theory of the leopard's spots has fallen out of favour. Instead, a more prosaic idea has gained ground, based on what is known as reaction-diffusion pattern formation, in which chemicals that trigger the differentiation of cells in an embryo interact with one another to produce patterns that are then reflected in the fates of nearby cells. But that, too, has its difficulties. Just how much a process like this can be shaped by natural selection is unclear.

Reaction-diffusion patterns (which can be created in a laboratory using standard reagents) are simple and deterministic. That simple reactions of this sort sometimes result in cryptic patterns could be a coincidence. Nevertheless, the details of the patterns produced vary, according to things like how rapidly the chemicals diffuse. That could be selected. Different cats do, indeed, have different patterns. So researchers at the University of Bristol, led by William Allen, have been deconstructing these patterns, trying to match the elements to cats' habits and habitats, and thus show whether the patterns are evolving. They published their results this week in the Proceedings of the Royal Society.

The reaction-diffusion process can be mimicked by a computer, and the program's parameters manipulated to produce patterns matching those of cat coats. That, the researchers hoped, might help illuminate what is going on. They trawled the world wide web for pictures of wild cats, found the best six for each of 37 species, and roped in a group of human volunteers to choose which of the program's outputs were most similar to real coats.

The patterns produced had five parameters: how plain they were, how irregular, how complex, how big the spots were and whether the pattern had a perceptible direction to it. The volunteers' judgments about which artificial patterns best matched which natural ones were almost perfectly consistent. That allowed Mr Allen to assess which parameters contribute to each species's pattern, and thus which are correlated with behaviour.

The biggest distinction—no surprise, but nice to confirm—is that spotted cats are forest cats and plain ones prefer open countryside. In that, Kipling was right. An analysis based on the relationship between the species, though, shows that evolutionary lines can swap from spots to no spots, and vice versa, as the habitat dictates. Moreover, the more a species prefers the forest, the more irregular the pattern it sports, and the more complex. (Size and direction have no effect.) Even among forest-dwellers there are differences. Those that tend to spend their time actually in trees, as opposed to wandering around on the ground between them, have more irregular and complex patterns. And, crucially, there is no relationship between a cat's pattern and how sociable it is. That knocks on the head an alternative explanation for coat patterns, namely that spots are some form of signal between animals of the same species.

Mr Allen and his colleagues made one other observation. Some species of cat regularly produce melanic forms—the so-called black panther (actually a melanic jaguar) being the most familiar.

The data seem to rule out one obvious explanation for melanism: the idea that black cats, with their unusual appearance, have more success hunting because their prey are not keeping an eye out for predators that look like them. Melanic forms, though, are particularly prevalent in species with complicated lives—those that inhabit a range of habitats, are active both day and night, and move between the ground and the trees. What advantage melanism brings in these circumstances is obscure. One for Kipling, perhaps. “How the jaguar got his melanocytes.”