Skip to content

clinm/automaton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Automaton This is my first project since I have learn Javascript. It is a mean for me to practise and share this beautiful little things that are cellular Automatons.

#Overview This project is using a HTML5 canvas to graphically displayed the automaton. For now, I am only implementing several 'life like' automatons.

#Usage ##Creation

var myAutomaton = Automaton.automata({surfaceId: 'displayId',     // HTML canvas' ID
                    numberElements: [10, 10],                     // number of elements on each dimension
                    colors: ['#629F61', '#69394A'],               // color for each state
                    freqUpdate: 100},                             // update frequency in ms
                    auto: 'conway'                                // default is conway, values available are 
                                                                  // in the list below
                    );                  

The automatons available are :

Injecting custom life like automatons is also possible:

var customLifeLike = ['lifelike',       // keyword to detect lifelike automaton
                        [1,2,3],        // number of neighbours needed to come to life
                        [4,5,6]         // number of neighbours needed to stay alive
                     ];
var myAutomaton = Automaton.automata({surfaceId: 'displayId', auto: customLifeLike});                  

##Start and Stop

    myAutomaton.start();
    myAutomaton.stop();
    
    // compute only one iteration
    myAutomaton.nextIteration();

##Frequency's update

    myAutomaton.start();
    myAutomaton.updateFrequency(10);
    myAutomaton.updateFrequency(100);
    myAutomaton.updateFrequency(1000);
    myAutomaton.stop();

##Default values Here is described the default value for each parameters

Field Type Default value
surfaceId string non optional
freqUpdate number 1000
numberElements [number, number]) cells 10px*10px computed
colors [string, string] ['#D1D1D1', '#DD5856']
auto string conway
circular boolean false

#Example The index.html page in a basic application where all parameters are customisable. Enjoy ! #Incoming features

  • First implementation of a Cellular Automaton
  • Better looking interface
  • Add more Cellular Automaton
  • Interface allowing to change parameters on the fly
  • Additional parameters to generate custom life like automatons
  • Basics patterns for each automaton instead of random generation

About

Cellular Automaton such as Conway's Game of Life

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published