iggi — code that grows like moss
A spreading-algorithm library for resilient, distributed computation. Seed a cell, define adjacency rules, and watch your system colonize available substrate — modest, but unstoppable.
npm install iggi
or
pnpm add iggi
Root — the substrate
Everything begins at the root: a typed grid of cells over which growth propagates. The root holds no opinion about geometry — it is merely a field of states that spreading rules act upon.
import { Substrate, grow } from 'iggi' const field = Substrate.of({ width: 40, height: 30 }) field.seed(12, 8) // drop a spore grow(field, { rate: 0.3, decay: 'natural' })
Branches — spreading rules
Branches define how a colonized cell reaches its neighbours. The default rule colonizes the four orthogonal neighbours with probability 0.3 per tick; cells pass through a brief growing phase before becoming fully active. Click the field below to seed it yourself.
Leaves — fine configuration
Leaves are the tuning surface: per-edge weights, anisotropic spread, density caps, and adaptation hooks. Configure once and the colony self-regulates.
- Adaptive spread velocity with substrate-aware backpressure
- Anisotropic growth — bias colonization along any axis
- Deterministic replay from a single integer seed
- Zero-dependency core; runs in Node, the browser, and at the edge
API reference
Substrate.of(dims)
Create a new growth field of the given { width, height } dimensions.
field.seed(x, y)
Plant a spore at cell (x, y). Multiple seeds compose into one colony.
grow(field, opts)
Run the spreading loop. opts.rate sets per-tick colonization probability; opts.decay controls senescence.
field.adapt(env)
Re-weight spreading rules in response to a changed environment descriptor.
Spores — distribution
Spores are lightweight, self-contained colonies you can serialize and ship anywhere. Drop one into a new substrate and growth resumes exactly where it left off — the colony in the panel below is releasing them now.
Ecosystem
iggi grows alongside the tools you already use. Compatible substrates and integrations: