Javascript implementation of cellular automata