subpixels.com | SPXL.TVblog | contactgallery | videoflash | processingmyspace | facebook

Conway’s Game of Life 31 December, 2008 at 6:58 pm

Processing sample: Conway_mod_by_spxl

Conway_mod_by_spxl
based on Conway.pde by Mike Davis

Source code: Conway_mod_by_spxl.pde

Another sketch derived from one of the examples that comes with Processing, this time a simulation of John Conway’s “Game of Life”, which I once coded in AMOS Basic (on my Amiga500) and even wrote a version in 68k assembly language… that version ran pretty fast as it operated directly on the memory used for the display! When I say fast, though, you have to remember the Amiga’s Motorola 68000 processor was clocked at less than 8MHz! The program also took control of the processor – no multitasking, no mouse nor keyboard input, nothing… it just ran (I think I had to reboot to end). I recall that to count a cell’s neighbours I used some bit-shifting and a lookup table for extra trickiness (and hopefully speed, though I didn’t code a different version to speed-compare against).

My contribution for the Processing version: optimisations improving execution speed by around 30%, and pretty colours – instead of white on black, the “live” colour is a bright saturated colour that cycles through all the hues; the “death” colour is the same hue, only not quite saturated and not as bright (note that the cell is coloured based on when it was born / when it died, so the display gives a coloured timeline for both live and dead cells).

If you really want to see fast, try Golly which lets you run insanely large worlds and unbelievably fast. If you’ve ever seen diagrams on the “theory” of building complex computer parts with millions of cells, this program actually runs them!

Well, that’s about all from me for this year. Happy New Year!

-spxl

2 Responses to “Conway’s Game of Life”

  1. will you help me do this task:A)By hand work the first four iterations of the following Game of life initial iteratios:a)Beehive b)R-Pentomino c)Ship.
    B)By hand work out the first four iterations of R-Pentomino and Ship with these new rules:a)A dead cell with exactly two neighbours becomes a live cell b)A live cell with exactly 3 or 4 neighbours stays alive .c)In all other cases a live cell dies and a dead cell remains dead.
    I would be very grateful for your help.

  2. Hmm… Well, given that my hand is in Australia and your hand is in Ireland (or thereabouts), I’d have to say no, not any time soon.

    It sounds like a tutorial/assignment task, in which case I suggest you apply yourself a bit more and get on with it.

Leave a Reply