How it works under the Rete Algorithm:
There are zero imperative
for loops iterating over the grid. Instead, each generation runs through 5 declarative stages:
- Emit Votes: Live cells join with 8 directional delta vectors to assert neighbor candidate votes with toroidal modulo wrapping.
- Tally Votes: An accumulator pattern consumes votes and tallies them per coordinate.
- Evaluate Conway Rules: Relational pattern tests trigger
birth (count=3) and survival (count=2,3).
- Clear & Promote: Retracts old cells and promotes
next-cell facts.
- Quiescence: Execution pauses naturally when no rules match, waiting for the next tick.