Cellular Automata with Sound – Clap loud to produce cool patterns(automata-sound.vercel.app) |
Cellular Automata with Sound – Clap loud to produce cool patterns(automata-sound.vercel.app) |
Tweet : https://twitter.com/JosiasWing/status/1566753445855494150?s=...
You fix this by having one 2d array to store the current state of the board, and then you have a second array in which you calculate what each cell is going to be on the next generation. Once you've calculated all the new cells you replace the first array with the second.
This is such a classic mistake that we even have a name for it: NaiveLife (https://conwaylife.com/wiki/Naive).