This periodic cellular automaton simulates a Belousov-Zhabotinsky reaction. See also my Activator-Inhibitor cellular automaton.
(* runtime: 27 seconds *)
n = 50; SeedRandom[0]; image = Table[Random[Integer, {0, 255}], {n}, {n}];
Do[image = Table[z = image[[i, j]]; zlist = Flatten[image[[Mod[i - {0, 1, 2},n] + 1, Mod[j - {0, 1, 2}, n] + 1]]]; If[z == 255, 0, a = 9 - Count[zlist, 0]; If[z ==0, b = Count[zlist, 255]; Floor[(a - b)/3] + Floor[b/3], Min[Floor[Plus @@ zlist/a] + 45, 255]]], {i, 1, n}, {j, 1, n}]; ListDensityPlot[image, Mesh -> False, Frame -> False], {200}];


0 Responses to “Belousov-Zhabotinsky (BZ) Reaction”