Conway
This behavior causes an agent to follow the Game of Life rules created by John Conway. Agents are either alive or dead, as specified by the boolean alive property. A live agent remains alive if it has 2 or 3 neighbors, otherwise it dies. A dead agent comes to life if it has exactly 3 neighbors.
Published by
Shortname
@hash/conway.rs
Description

This behavior causes an agent to follow the Game of Life rules created by John Conway. Agents are either alive or dead, as specified by the boolean alive property. A live agent remains alive if it has 2 or 3 neighbors, otherwise it dies. A dead agent comes to life if it has exactly 3 neighbors.

Example

This agent will start out alive and change state based on its neighbors:

const conwayAgent = {
    behaviors: ["conway"],
    position: [6, 3],
    alive: true
})