pygame is
Simple DirectMedia Layer is
Site Swing
Conway's Game of Life

Conway's Game of Life

John Slavick (readysquid)



This is my first project using the pygame library. It came together rather quickly, but my algorithm needed some optimization. So after iterating over my code, I managed a 5x performance improvement. To see all the available command line arguments: --help My favorite settings: --gridsize=256 --numcells=10000 To profile the code as I did use: --gridsize=256 --numcells=10000 --profile I feel my implementation is pretty optimized. But if you know of any other optimizations, please comment on my blog to let me know about them. Thanks.


Home Page: http://deleted


click to view original size account Comments

If you wish to leave a comment with your account, please sign in first.

January 26, 2011 12:49am - Charlie Harrison - nickname: (theratking)
I haven't read your code but based on how much worse it performs on a larger grid, I'm assuming that your codes performance is in some ways proportional to grid size. In that case you might try to only care about "active" cells. Inactive cells that are surrounded by inactive cells will never change
July 26, 2009 12:14am - John Slavick - nickname: (readysquid)
Thanks for the comments guys. I added the ability to create/kill cells with the mouse. I wanted that feature as well, so I don't know why I didn't do that in the first place.

I hadn't considered coloring the cells at all because I like the black and white look. But feel free to grab the source and change it if you'd like!
July 25, 2009 8:45pm - Chris Weisiger - nickname: (derakon)
Have you thought of colorizing the cells based on their age or neighbors or something?
July 24, 2009 7:22pm - Clayton G. Hobbs - nickname: (ratfink) - 4/5
Pretty cool. I was thinking of doing something like this myself, but I guess you beat me to it. It would be nice if you could set cell states with the mouse (left-click on a cell to toggle state).

our projects welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
recent releases
Feb 21, 2017

Jan 31, 2017

Jan 24, 2017

Jan 18, 2017

Jan 7, 2017

Dec 30, 2016

Dec 8, 2016

Nov 28, 2016

Nov 27, 2016

... more!
for pygame related questions, comments, and suggestions, please see help (lists, irc)