I would like to generate a random 100 x 100 Lattice, plot this and then, say, the first 3 iterations of Conway's Game of Life.
How can I do this with Mathematica?
I only came up with:
gameOfLife = {224, {2, {{2, 2, 2}, {2, 1, 2}, {2, 2, 2}}}, {1, 1}};
board = RandomInteger[1, {100, 100}];
ArrayPlot[board]
ArrayPlot[Last[ CellularAutomaton[gameOfLife, board, {{0, 1}}]] ]
Does this show the first iteration?
RandomInteger
and not for instanceConstantArray
? Speed-wise there's not much of a difference, and both generate packed arrays (contrary toTable
which is 5 times faster), but I can imagine that 'random' may be confusing to the reader. $\endgroup$