The base class, Automaton, extends ig.Class and maintains a population of cells, some alive and the rest dead, the status of which it updates every time its step function is invoked. Subclasses should override this function to provide their own behaviour. One such subclass, Conway, is provided with the package and serves as a basic example.
Installation and Usage
Download the latest version from GitHub, then put automaton.js (the base class), conway.js (concrete subclass example), and other subclasses you might write in plugins/gamecubate/automata.
Then, in your game, require the subclasses you will use:
Then instantiate them:
// Conway is supplied along with the plugin
var myAutomaton1 = new Conway(rows, columns);
// Shifter is not supplied with the plugin,
// but is part of the demo.
var myAutomaton2 = new Shifter(rows, columns);
By default, the automaton has no live cells. To give it some, call its populate method:
// random-fill half of each automaton with live cells
Last, to trigger one evolutionary step of your automata, call their step method:
// inside game.update
And what I do with that?
The state of each automaton is stored in its data property. You can iterate over that and act upon the values you get (CellState.DEAD or CellState.LIVING).
via email (alexr at gamecubate dot com) or on the impact forums (alexandre).