Wintellect Blogs

Introducing SilverLife

8 Aug , 2007  

In the October 1970 issue of Scientific American (“Mathematical Games: The Fantastic Combinations of John Conway’s New Solitaire Game ‘Life’,” p.120), Martin Gardner described a mathematical game devised by Cambridge University mathematician John Horton Conway. The game, which was appropriately named “Life,” simulated the birth, death, and regeneration of cells or organisms whose “universe” was an orthogonal grid on a piece of paper. Each new generation of life forms was computed from the previous using a simple set of genetic rules, with the future of each cell in the next generation depending on the number of neighbors it had in the previous generation. Too many neighbors, and the cell died from overpopulation; too few, and it died from starvation. When conditions were just right, a live cell could be born into a previously empty space. Conway crafted his genetic rules carefully so that patterns wouldn’t grow too quickly or vanish too easily. Over a period of generations, simple patterns sometimes evolved into complex symmetrical patterns (even if they didn’t start out symmetrical), while others devolved into cyclical life forms or nothingness.

The previous paragraph appeared in a book about 16-bit Windows programming that I wrote in 1994. In Chapter 9 of that book, I presented a Windows version of Conway’s game of Life written in C. For fun, I recently built a Silverlight 1.1 version of Life that I call SilverLife. Give it a spin and let me know what you think.


SilverLife is easy to play. Just click some of the empty squares in the grid to populate them with cells. (Hold the left mouse button down as you move the cursor to “draw” cells into the grid.) Then click the Step button to evolve the cells one generation, or the Start button to evolve them many generations. You can control the speed of the simulation with the drop-down list at the top of the page.

SilverLife was written with Visual Studio 2008 Beta 2 and the Silverlight 1.1 Alpha Refresh. If you haven’t installed the Silverlight 1.1 Alpha Refresh control, you’ll be prompted to download and install it the first time you visit the page. You don’t need Visual Studio 2008 Beta 2 to view SilverLife in your browser, but you will need it if you want to play with the source code.

It’s fun to experiment with different cell patterns to see what you can produce, but the real reason I wrote SilverLife was to demonstrate some of the key features of Silverlight 1.1. Highlights include:

  • How to marry XAML and C#
  • How to create XAML objects dynamically in managed code
  • How to use DOM integration to handle DOM events in managed code and interact with DOM elements
  • How to use isolated storage to persist per-user settings (in this case, the speed selected from the drop-down list) on the host PC
  • How to read and write XML in Silverlight
  • How to use Storyboard objects as programmable game timers
  • How to write custom controls for Silverlight

You’ll find all this and more in the source code. Watch for new features to be added to demonstrate additional capabilities of the platform.