olivaw
binary state, one dimensional cellular automata rules
Last updated 4 years ago by lrlna .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install olivaw 
SYNC missed versions from official npm registry.

Olivaw

A one-dimensional, binary cellular automata library built in ✨ javascript ✨ .

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

Usage

var olivaw = require('olivaw')

var automaton = olivaw({
  rule: 110,
  population: 101,
  life: 500
})

// run the automata
var automata = automaton.set()

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

olivaw.set()

Sets up and runs your automata through it's life span. Will use the opts of rule, population, and life that you've provided when you set up olivaw.

Given you have this set up:

var olivaw = require('olivaw')

// set up this instance of olivaw 
var automaton = olivaw({
  rule: 110,
  population: 2,
  life: 3 
})
// run through a generation
var automata = olivaw.set()

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 cell
    { state: 1, right: 0, left: 1  },
    { state: 0, right: 1, left: 1  },
  ],
  [ 
    { state: '1', right: '1', left: '1'  },
    { state: '1', right: '1', left: '1'  },
  ],
  [ 
    { state: '0', right: '0', left: '0'  },
    { state: '0', right: '0', left: '0'  },
  ]
]

Install

npm install --save olivaw

Current Tags

  • 2.0.3                                ...           latest (4 years ago)

9 Versions

  • 2.0.3                                ...           4 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |