## Inspiration

I came upon Propagate a few weeks ago and wasted a whole afternoon fiddling around. I got the idea of implementing a similar idea locally in Mathematica. The project so far isn't much more than a limited-functionality clone of its predecessor, but it's evolving and taking on some unique characteristics that may someday distinguish it.

## What it does

Promulgate is a local simulation of a tiny garden ecosystem. Plants have buds, which at any time tick execute a function telling them to grow up, down, left, or right, or to seed[] a new plant, split[] off a new bud or terminate[]. Plants compete for light to give them energy to grow; when an old plant dies, shoots in the underbrush fight each other to grow up and take its place.

Grow-functions are designed by the gardener: you engineer some plants, sow their seeds, and then sit back to watch them live and reproduce. A special focus that I've taken is a functional-programming approach. In QH's Propagate, grow-functions are written as procedures in Lua. In my version, anything you can do with the Wolfram Language can be computed by a bud, and since WL programming is largely functional, you will find yourself looking at the role of a bud differently. However, I haven't yet wanted to place any explicit limits on what can be programmed or how, so the buds remain multi-paradigm; for example there's still a little mutability, if that's what you're into. Each bud carries with it a little bit of memory that can store any WL expression. It can read and write to this memory, and pass it down to its descendants.

## An example

This little guy uses the "Meta" field as a genome. A population of randoEvos will quickly evolve to become taller and taller.

``````randoEvo[bud_] :=
If[! ListQ@bud[["Meta"]], (*If the meta variable is not initialized*)
writeToMemory[bud[["PlantID"]], bud[["BudID"]], {RandomChoice[{1, -1}], RandomInteger[{3,8}]}], (*then set a random "genome": {direction, height}*)
With[ (*Otherwise, proceed*)
{h = Length@bud[["CoordHistory"]],
pm = bud[["Meta", 1]],
hmax = bud[["Meta", 2]]
},
Which[ (*"If, then, elif, then, etc." in Wolframese*)
h < hmax, up,
hmax <= h <= 1.75*hmax, pm*right,
motherPlant[bud][["Energy"]] >= seedEnergy + 10,
seed[seedDir -> pm*right,
meta -> {RandomChoice[{1, -1}],
RandomReal[{.75, 1.25}]*hmax}] (*mutate genome*)
]
]
``````

?? We'll see.