Skip to content

Rule

Rules are a way to define the evolution of elements over time. You can create a new rule on any element or kind with the builder method to.

const space = vi.element("space", "blue");
const alien = vi.element("alien", "green");
space.to(alien);

[Image of a cell and 8 neighbors showing the transition between before and after]

Instead of passing a predetermined element, you can also pass a neighbor.

space.to(vi.neighbor.TOP);

In this example, space is going to evolve to whatever element is above it.