Cellular automata in JavaScript