One-dimensional cellular automata: Difference between revisions

m
(Added JavaScript)
Line 750:
 
=={{header|JavaScript}}==
The example below expects an array of 1s or 0s, as in the example algorithm. It also adds dead cells to both ends, which aren't included in the returned next generation.
 
state[i-1] refers to the new cell in question, (old[i] == 1) checks if the old cell was alive.
Anonymous user