The ocellated lizard — known as the jeweled lacerta in the pet trade — is born rusty brown with white polka dots. Within a few months, its skin begins to change into a dizzying, labyrinthine array of black and bright green pixels. By the time the lizard has sexually matured, reaching up to two feet in length, some 4,000 scales along its back are all black or green, possibly to accommodate a habitat change between early life and adulthood. Through the rest of the lizard’s life, many of these scales will continually flip between black and green.

These outfit changes are dazzling in their own right. But even more surprisingly, the lizard’s patterns may unfold like a computer simulation, according to a study published in Nature on Wednesday.

Studying ocellated lizards, Michel Milinkovitch, a professor of genetics and evolution at the University of Geneva, noticed the animals’ scales seemed to behave like a cellular automaton, a rule-based model often used in computer science. The general rule was that green scales tended to have four black neighbors, and black scales tended to have three green neighbors.

Though cellular automata are commonly used to simulate biological systems on computers, this is the first example of a “living cellular automaton,” said Dr. Milinkovitch, an author of the paper.