Conway's Game of Life on .NET 3.0

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Here's something for the Windows Forms programmers and people interested in the new user interface technologies in .NET 3.0 and Windows Presentation Foundation. If you don't program but are interested in curious little simulations you might also find it worthwhile.

I spent the last few weeks diving into WPF and XAML (declarative language for GUI markup on Windows), and I have to say the whole package is pretty damn slick. The result of my explorations was an implementation of John Conway's famous Game of Life in XAML and C#. I'm not close to the first person to do this, but I think this version is pretty polished, and I wrote up an article covering all aspects of how it was programmed. The source code is included if you want it, and there are more than 50 saved Life models to play with. In addition you can visit the Life Lexicon and drag their models off the site and onto the program's main window.

You can download just the program here, or get everything in that archive plus the Visual Studio 2005 source and project files here.

The program will run on Vista without any additional components. Just unzip the archive to a folder and run AvalonLife.exe. To run it on XP you'll need the .NET 3.0 runtime components, which are here. If you want to build the source you'll need one or two other components for VS2005. Instructions are in the help file and the first post of the article, which can be found here. There is a screenshot near the top of that post, as well as on the home page of my site at http://www.markbetz.net.

Let me know what you think, and if you encounter any problems with the program please post back to this thread and let me know about them.
 

Mark R

Diamond Member
Oct 9, 1999
8,513
16
81
I'd like to try it but can't run .NET 3.

:(

nice article, though. keep up the good work. Will have to try it once I get a more modern PC.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Originally posted by: Mark R
I'd like to try it but can't run .NET 3.

:(

nice article, though. keep up the good work. Will have to try it once I get a more modern PC.

Thanks :). I take it you mean you can't run XP or Server 2003?
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
I'd love to hear what you think, Dave. The framework is really impressive, in my view. Not too bad install-wise, and it won't disrupt any of the other .Net installs.

Thanks for the tip on CodeProject.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Originally posted by: MangoTBG
This isn't the Game of Life that I remember from my childhood!

If you mean the one where you moved the little cars around the board... no it's not :)
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
.NET 3.0 fully encompasses .NET 2.0. If you install 3.0 on a machine that has neither, when you're done you have all of 2.0 and 3.0 installed.
 

Seekermeister

Golden Member
Oct 3, 2006
1,971
0
0
Next question(s)...am I correct in believing that .NET is only for online games? Is there any downside to upgrading?
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
No, .NET has nothing to do with online games, and I doubt any have been written that use it. It is strangely named, but essentially it is an object-oriented API to the core functions of Windows.

There is no downside to upgrading.
 

Seekermeister

Golden Member
Oct 3, 2006
1,971
0
0
If you will bear with me, another question. Why isn't this version available when I go to Windows Updates? It has .NET2.0, but it is over 20MBs, and .NET3.0 is only 2.8MBs. It would seem that if 3.0 includes the former, it should be at least as large.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
As I recall the .NET 3.0 setup is a web installer, that then pulls the other files over. If you follow the link in my original message, download and run the file dotnetfx3setup.exe, you'll be all set.
 

Seekermeister

Golden Member
Oct 3, 2006
1,971
0
0
Okay, I know that I just complaining up a tree, but I thought that the term "redistributable" meant that an item could simply be downloaded, so that it could be installed multiple times. I really dislike web installers, but I guess I have no choice.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Originally posted by: Seekermeister
Okay, I know that I just complaining up a tree, but I thought that the term "redistributable" meant that an item could simply be downloaded, so that it could be installed multiple times. I really dislike web installers, but I guess I have no choice.

Redistributable just means (in this case) that it includes only the runtime components, and not any of the development files or tool, and you have the right to redistribute it. How you do that is not specified.
 

Seekermeister

Golden Member
Oct 3, 2006
1,971
0
0
I've got .NET 3.0 installed, but I'm having a problem with the game link. I just get a blank page that never finishes loading. I'll try again later.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Might have been something going on with the server. It appears to be up now. The blank page is just the new window that AT pops on all links from the forum. The actual URLs go directly to the files on my HTTP server.
 

Seekermeister

Golden Member
Oct 3, 2006
1,971
0
0
Downloaded and installed. Interesting, but I guess I'm not enough of an egghead to appreciate it that much.
 

garkon

Senior member
Aug 13, 2004
608
1
76
What is this life lexicon thing, im just not getting it. I mean, what dose this mean :17c/45 spaceship A spaceship travelling at 17c/45. No such spaceship has actually been built, but Jason Summers has written up a plan for making one (see http://entropymine.com/jason/life/17c45/). The resulting spaceship would be so huge that building it without the aid of specialized software would be practically impossible.

Do people sit and watch this program, and "discover" things. Do they just call something whatever they want, i'm confused, someone explain to me how retarded i am.
 

dorion

Senior member
Jun 12, 2006
256
0
76
Garkon its a Mathematicians play thing. There are lots of areas in Game of Life that are studied, Still Life, Infinite Patterns, Self Replicating Patterns, even simple computers(yes computers inside of a simulation on a computer.) Game of Life is just one Cellular Automaton out of infinitely many types. As for the question 17c/45 if I remember correctly that is the speed the pattern moves, for being such a large ship its very fast, 17 cells every 45 generations. The Life Lexicon is a collection of Life.

Oh yeah heres the ship.
http://www.yucs.org/~gnivasch/life/index.html
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Originally posted by: garkon
What is this life lexicon thing, im just not getting it. I mean, what dose this mean :17c/45 spaceship A spaceship travelling at 17c/45. No such spaceship has actually been built, but Jason Summers has written up a plan for making one (see http://entropymine.com/jason/life/17c45/). The resulting spaceship would be so huge that building it without the aid of specialized software would be practically impossible.

Do people sit and watch this program, and "discover" things. Do they just call something whatever they want, i'm confused, someone explain to me how retarded i am.

Haha, I feel your pain. I can understand how to program it much better than I can understand how to interpret what it does.

The Lexicon is just a place that stores models (patterns) in a certain format, namely .CELLS. The naming convention is sometimes explained, sometimes not. If you see Px, for example, like P5 or P148, it means the pattern cycles through that many iterations and returns to its starting point.

Whether you're deep into the math or not, it's kind of neat to load some of the patterns and see what happens when you run them. I like to run them at high speed, especially gliders (a pattern that wobbles across the grid maintaining its basic shape), and shuttles (a pattern in which some shape cycles back and forth between blocking shapes).