::azr_log
About
Hint: Refresh the page for more patterns!

This is a fun generative art piece I made inspired by plant growth and the emerging patterns in nature that arise from simple rules.

The working principle is based on agents traversing a square grid, leaving a trail as they move. There are different types of agents, each with their own sets of rules. One such rule is that they are never allowed to cross a previous path, which forces this maze-like formation.

There are a couple key aspect that really make this work.

Inheriting the RNG

Agents move randomly according to a pseudo-random number generator (PRNG).

Those number generators have an internal state the dictates which outcome they will choose when you request a number, and whenever you do, the internal state changes in a deterministic way.

Each individual agent has its own PRNG, and every time the agent splits (or branches off), it's copied over to the agent's children, and therefore they will produce the same sorts of patterns (that is, until they diverge due differences in their environment).

All of the agents' actions are taken relative to their heading direction (turn left, turn right, move forward). To enable more symmetries, their direction is not only represented as a rotation, but a chirality as well (clock-wise or counter-clockwise). Thus the direction can be represented by the dihedral group Dih4.

One very neat aspect of this inheritance mechanism is that it enables many scales of symmetry: Typically, the first agent will quickly split, and since there aren't many paths yet, they will be able to produce large patterns without diverging, resulting in very large-scale symmetries. However, the agents could also quickly collide and diverge, producing more chaotic patterns.

Mutation

Even with symmetry and randomness, results can still look too bland and predictable. This is where the second aspect comes into play: The genetic code.

Agents are associated with a piece of genetic code which describes their preferred behavior (e.g. likes to turn a lot, prefers horizontal lines, produces fewer branches, etc.) As time moves forward, the genome of agents sporadically mutates according to its random number generator, leading to different regions of the board having different visual properties.