Mathematica Student Edition
Mathematica Home Edition
Computable Document Format (CDF)
Aerospace Engineering & Defense
Biotechnology & Medicine
Finance, Statistics & Business Analysis
Financial Engineering & Mathematics
Financial Risk Management
Software Engineering & Content Delivery
Authoring & Publishing
Social & Behavioral Sciences
Design, Arts & Entertainment
Game Design, Special Effects & Generative Art
STEM Education Initiative
Community & Technical College Education
Primary & Secondary Education
Computable Document Format (CDF)
High-Performance & Parallel Computing (HPC)
See Also: Technology Guide
Other Ways to Buy
Volume & Site Licensing
Does My Site Have a License?
Wolfram User Portal
About Wolfram Research
Stephen Wolfram's Home Page
Wolfram Functions Site
More Info >>
Mark as an Answer
Game of Life programs in WL
I wanted to note that I've just posted a pdf and nb of a newly revised version of my tutorial "Wolfram Programming Language Fundamentals" at the Wolfram Library Archive:
Wolfram Programming Language Fundamentals
I've changed the last section (pp. 40 - 43) in the pdf so that it now demonstrates the use of WL to write a program, actually two of them, for the Game of Life (GoL). While the programs (on p. 42) are slower than the GoL program that is essentially a function call to the built-in CellularAutomaton function, it has the advantage of having all of its operational details shown (I have never been able to figure out CellularAutomaton - it's a black box to me in terms of what its input values represent and what it is 'doing' when it is evaluated). the second of the programs is a 'one-liner' that uses an anonymous function that is comprised of 3 other anonymous functions which appeals to the APL'er in me (I like terse 'write-only' code) although it can be readily deciphered by comparing it to the first program. i've used the GoL program becuase IMO it is the most fundamental of all CA's with fundamental implications on the phenomenon of 'emergence' (reference is made at the end of the tutorial to material by Stephen Hawking and by Nigel Goldenfeld that people interested in modeling various phenomena with CA's and in the concept of computational irreducibility might want to look at).
Richard, this is great thanks for posting. If you'd like you could write a separate post announcing the tutorial itself, maybe saying a few words how you came about writing it, what it covers, whom it intended for, - whatever you feel suitable. About Game of Life, we'd like to mention a related Demonstration, not sure if you have seen it, -
2D Cellular Automaton Animations
. We think you and other would be curious to take a look. It covers not only Game of Life, but also a lot of similar in nature Cellular Automata.
thanks for the reference to the 2D CA demo - i hadn't been aware of it. however, the description say: "This Demonstration explores patterns generated by 2D cellular automaton rules depending only on the number of black cells surrounding a given cell". does this mean that it doesn't depend on whether the given cell is black or white? if so, this Demo does not do the GoL which uses two different update rules for a site with exactly two black (living) neighboring cells, depending on whether the given cell is black (alive) or white (dead) - a black (living) cell surrounded by 2 black (living) cells remains black (alive) while a white (dead) cell surrounded by 2 black cells remains white (dead). Is the description wrong?
btw - a number of Demos have incorrect descriptions - e.g. the self-avoiding random walk demo is NOT used in the model of polymer chains, despite what the description says. i know this as a theoretical polymer physicist specializing in random and restricted walk models of polymer systems and i explained in detail, to whoever wrote the description, why that is an incorrect statement and while the description was subsequently changed, the incorrect statement remains unchanged.
does this mean that it doesn't depend on whether the given cell is black or white?
It is just an ambiguous choice of words. I think when they said "given" they assumed "given black" or "given white" as separate cases. And indeed I checked the code - it does depend on the value of central cell and is defined as an
Outer-Totalistic Cellular Automaton
Thanks for posting this tutorial - I think it's very good!
Just wondering - the font is Courier throughout - it's a bit unusual. Is this deliberate, or something wrong with my machine (I know that sometimes PostScript and PDF default to Courier when things go wrong..)?
glad you find the tutorial useful. i use Courier when i write technical material becuase it is the traditional typeface for code. (http://en.wikipedia.org/wiki/Courier_(typeface)#In_computer_programming) and i like the look.
De gustibus non est disputandum
ROFL. saying that it's just an 'ambiguous choice of words' is like saying "if you like your healthcare policy, you can keep it. period" is just 'imprecise'. i think what you mean to say is that the description of the Demo is 'incorrect'.
The Caption section to 2D Cellular Automaton Animations is, arguably, incomplete. I did not see anything that would indicate it is incorrect.
(We try to catch outright errors in the curation process. Granted, some get through.)
i don't want to belabor the point (after all. it's not my demo) but i would suggest that the description be changed from "depending only on the number of black cells surrounding a given cell." to "depending on the color of a given cell and the number of black cells surrounding it". it would also be useful to state in the description that the Demo can be used for outer-totalistic cellular automata (it's good to use the proper notation when possible for educational purposes).
btw - here's a pretty interesting video for 1D CA freaks:
Minecraft - Elementary Cellular Automata Visualizer (Complete Wolfram Code)
note - i am not one of those. i mean, i am a geek - and proud of it - but don't i find 1D CA's all that interesting, possibly because SW has already studied them ad nauseum, and because i think that dimensionality is all-important (that probably comes from my having been a random- and restricted-walk specialist and dimensionality is all-important in random walk properties and also because i live in a multi-dimensional world (though i'm not sure exactly how many dimensions) and i think (am i wrong?) that the 2D GoL shows ALL the interesting properties of 1D CA's (e.g. being Turing complete) and additionally, clearly demonsrtates emergent phenomena (e.g. the glider pattern) which has great relevance to foundational (fundamental) issues in physics (on the last page of the tutorial (p.43), i refer to material by Hawking and by Israeli and Goldenfeld which is TOTALLY (and i don't mean just outer-totally LOL) relevant to people thinking about things such as computational irreducibility and the limitations of computability (and hence of physics and perhaps all of science)),
unfortuntely, as noted in
, there are 2^512 = 1.341 x 10^154 possible two-dimensional CA's ( for the simplest CA's with only two states and only touching cells being considered as belonging to a neighborhood (btw - does anyone know how this number is affected by the use of the von Neumann neighborhood rather than the Moore neighborhood?).
aside: maybe we can re-write Arthur C. Clark's "The Nine Billion Names of God" short story using geeks calculating ALL of the possible 2D CA's. that way, the story ending will be more upbeat since they'll never complete their task during the 'natural' lifetime of the universe.
description seems strange to me (it says that " the Wofram code does not specify the size (nor shape) of the neighborhood, nor the number of states" but that's wrong - s does specify the number of states.
r = number of rules
s = number of states
n = neighborhood size (radius of the neighborhood)
r = s^(s^((2 n + 1)^d))
and my question remains: what neighborhood (Moore or von Neumann or something else) does n = 1 in 2 dimensions correspond to - don't BOTH have an n value of 1 (only nearest-neighbor cells are in the neighborhood in each case) even though certainly, they must have a different number of possible rules since one has 4 neighbors whie the other has 8 neighbors.