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

Conway's Game of Life

John Slavick (readysquid)

Tags:

Description

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: Life.py --help My favorite settings: Life.py --gridsize=256 --numcells=10000 To profile the code as I did use: Life.py --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.

Links

Home Page: http://deleted

Screenshot


click to view original size

Pygame.org account Comments

If you wish to leave a comment with your pygame.org 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).
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Sep 19, 2014

Sep 17, 2014

Sep 9, 2014

Sep 8, 2014

Sep 7, 2014


Sep 5, 2014

Aug 26, 2014

Aug 21, 2014


Aug 18, 2014

Aug 2, 2014

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