Olivaw allows you to work with any of Wolfram's elementary automata by providing one of the 256 rules.
The concept of one dimensional cellular automata is fascinating and sometimes might seem quite complex, I've put together an illustrated guide to help you understand it better.
You can also find a working example over at /cellular-automata
var olivaw =var automaton =// run the automatavar automata = automaton
The output you get is an ndarray (or a nested, multidimensional array) of automata, where each array is a year in the generation of an automata. It's best to set the generation to run for over 100 years for more interesting results ✨.
automaton = olivaw(opts)
Create a new instance of olivaw by providing a set of options. These three options are required:
- opts.rule: one of 256 rules for the automata to follow
- opts.population: the population size, or the number of cells you want to work with
- opts.life: life span of an automata instance, or the number of years it will run for
Sets up and runs your automata through it's life span. Will use the opts of
life that you've provided when you set up olivaw.
Given you have this set up:
var olivaw =// set up this instance of olivawvar automaton =// run through a generationvar automata = olivaw
olivaw.set will return the following output that you could then work with to
display or manipulate the data:
// automata generation// year in a generation//individual cellstate: 1 right: 0 left: 1state: 0 right: 1 left: 1state: '1' right: '1' left: '1'state: '1' right: '1' left: '1'state: '0' right: '0' left: '0'state: '0' right: '0' left: '0'
npm install --save olivaw