1 Attachment(s)
Conway's Game Of Life cellular automaton
Hey,
Here's a quick project I made while bored.
It's about the cellular automaton often called Conway's Game Of Life:
http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
I thought it could be useful for people so decided to clean it up a bit and post it. I added support for:
- Different grid sizes
- Different cell sizes (set during design-time)
- Loading and saving grids
- Playing / Pausing
- Stopping, which resets the grid back to how it was before you pressed Play.
Screenshot:
http://i49.tinypic.com/2zrdbax.jpg
While not running, you can paint cells that are alive by using the left mouse button, and you can 'kill' cells using the right mouse button.
To change the speed of the 'simulation', just change the Interval property on the timer.
The code should be very easy to follow (there's not much of it), but if you have any questions don't hesitate to ask :)
Re: Conway's Game Of Life cellular automaton
How can i run this program?
Re: Conway's Game Of Life cellular automaton
I posted the source code, so just open the solution or project in Visual Studio and it should load it for you. Then just run as usual.
Re: Conway's Game Of Life cellular automaton
What version is this? I tried opening it in vb 2005, says it's a newer version.
Re: Conway's Game Of Life cellular automaton
It's made in VS2008, but I'm pretty sure you can just import the files into a new VS2005 project.
Re: Conway's Game Of Life cellular automaton
Gliders turn into blocks when they hit the wall of the grid. That's not supposed to happen...
Re: Conway's Game Of Life cellular automaton
Oh, I dunno sorry :p
Not quite sure how I implemented the edges, but I think I simply return a new (and thus, dead) cell when the x or y value is outside the range of the grid. How would I implement it differently, and how do the gliders need to behave then?
Re: Conway's Game Of Life cellular automaton
If the glider is unobstructed it will continue forever, so I guess you will have to simulate it going off the grid and then disappearing.
Re: Conway's Game Of Life cellular automaton
that said one of the things with the game of life is adding new rules, i was looking at an example of life which used LINQ, this author had a rule where cells would die when they got over a certain age. I kinda like the idea of cells living forever on the boundary, kinda like a safe haven, a warm bit or something ;) it would work well if an age rule was used as well. then you could say introduce obstacles in the map which would do the same (or kill them if a diff colour?) lots of fun an good to see Life on this forum :)
EDIT: just for completeness here is the article i was looking at, it is in C# though but the theory is the same
http://www.codeproject.com/KB/linq/l...63#xx3378963xx
Re: Conway's Game Of Life cellular automaton
Interesting, I like messing around with GOL programs. I noticed one bug however, clicking cancel in the input dialog still returns a "Enter a valid col/row" message even though I canceled.
It also does not seem to like a larger grid. I tried with 300 cols/rows and it didn't run properly.
Regardless, thanks for helping me kill a few minutes at work lol.