Message Boards Message Boards

9 Replies
11 Total Likes
View groups...
Share this post:

Game of Life programs in WL

Posted 11 years ago
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).
POSTED BY: Richard Gaylord
9 Replies
Posted 11 years ago
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 Wolfram code, 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.

the Wolfram Code 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.
POSTED BY: Richard Gaylord
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.)
POSTED BY: Daniel Lichtblau
Posted 11 years ago
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'. 
POSTED BY: Richard Gaylord
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.
POSTED BY: Sam Carrettie
De gustibus non est disputandum  emoticon
POSTED BY: C ormullion
Posted 11 years ago
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.
POSTED BY: Richard Gaylord
Posted 11 years ago
glad you find the tutorial useful. i use Courier when i write technical material becuase it is the traditional typeface for code. ( and i like the look.
POSTED BY: Richard Gaylord
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..)?
POSTED BY: C ormullion
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.

POSTED BY: Moderation Team
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract