[Home] [By Thread] [By Date] [Recent Entries]

  • To: xml-dev@l...
  • Subject: Game of Life: an XSLT implementation
  • From: "Roger L. Costello" <costello@m...>
  • Date: Mon, 20 Oct 2003 10:21:55 -0400
  • Organization: The MITRE Corporation

Hi Folks,

I have implemented the Game of Life[1] using XSLT.

It's kinda neat!  It nicely demonstrates some aspects of complex systems
such as evolution, attractors and feedback.

For example, here is a simple starting configuration (a filled-in square
means it's a live cell, an empty square means it's a dead cell):

http://www.xfront.com/life/orig.html

After applying the rules of Life once, the configuration evolves to
this:

http://www.xfront.com/life/out1.html

Then, after applying the rules of Life to that output (i.e., feedback),
the configuration evolves to this:

http://www.xfront.com/life/out2.html

Below I chronicle the configuration's evolution.  It settles into a
repeating pattern when it gets to the sixth iteration (the pattern
alternates between configuration 5 and 6 indefinitely).  These two
states represents an "attractor".

http://www.xfront.com/life/out3.html
http://www.xfront.com/life/out4.html
http://www.xfront.com/life/out5.html
http://www.xfront.com/life/out6.html

Each configuration is represented as an XML document.  Here is the
initial configuration:

http://www.xfront.com/life/orig-Input.xml

Here is the stylesheet which applies the Life rules, and produces the
next configuration:

http://www.xfront.com/life/GameOfLife.xsl

Here is a stylesheet which creates a graphical image of a configuration:

http://www.xfront.com/life/GameOfLifeViewer.xsl

Many thanks to Tom Passin, Len Bullard, Didier Martin and Bob Foster for
their excellent suggestions and insight!

/Roger

[1] http://www.math.com/students/wonders/life/life.html


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member