Conway's Game Of Life

Here is something I've thrown just together with some spare time, let me know how I did. The most surprising thing about this is how watchable the whole thing is, SFML should seriously consider having this as a tutorial.


I wanted to put this in my GitHub, but I'm quickly losing patience with that sites over zealous bots so paste bin it is. You only have to link to SFML 2.1 Graphics, Window and System libraries if you want to try and run it.

- The graph isn't infinite like it is supposed to be, it's square and the size is set by the "Limit" variable on Line 19 in main.cpp. Likewise the tiles that start out living are "randomized", the number of them there are on the first turn is set in the "Living" variable on Line 21 of main.cpp.

- The White tiles are dead, the green ones are newly born this cycle and the black tiles are living ones.

- Left click on a dead tile to force it to "spawn". Left Click on a living tile to force it to die. This isn't part of the original "game" but I found that it makes things more interesting.

That was cool!

(But watch your compiler options)

Here's mine:

The tile array uses Limit which is non-const. Looks pretty cool with the different colors although it makes it harder for me to see the patterns.

Is the a method to pause or some other way to draw a pattern?

I made a game of life clone about a year ago but it isn't as pretty as yours. I also kept a static map size (although changeable) for simplicity, but I don't like how the cells will just stop at the border. I plan to re-do the project if I can build any initiative to actually do it.</tangent>
Yeah, I was wanting a way to pause and draw my own patterns too.
Wow, thanks for the feed back! I've added a pause feature using the space bar for anyone who is still interested. I've also put in a counter for both the number of living cells and the number of 'turns' that have passed. There may be something odd about the bounds checking on my tiles, it seems like if I'm too close to the edge of one tile I end up selecting multiples.


I think I addressed the issues you guys pointed out. Either way it's time for me to find my next project.
Topic archived. No new replies allowed.