Code Golf: Conway’s Game of Life

Mathematica – 179 163 154 151 chars a = {2, 2, 2}; s = Export[“out.txt”, CellularAutomaton[{224, {2, {a, {2, 1, 2}, a}}, {1,1}}, (ReadList[#1, Byte, RecordLists → 2>1] – 46)/ 42, #2]〚#2〛 /. {0 → “.”, 1 → “X”}, “Table”] & Spaces added for readability Invoke with s[“c:\life.txt”, 100] Animation: You can also get a … Read more

Issue with Game of Life

I suspect1 the problem with your code is that it is setting the cells to living or dead as soon as the neighbors are checked. That caused my early variants of this code to fail. That change of state has to be delayed until the entire grid (biosphere) has been checked. This example shows typical … Read more