Skip to content


Conway’s Game of Life – Flash BitmapData

Had this idea today Conway's Game of Life on a BitmapData Object. Each pixel is a cell. I'll release the source code when I refactor and comment it.

Rules:
1. Any live cell with fewer than two live neighbours dies, as if caused by underpopulation.
2. Any live cell with more than three live neighbours dies, as if by overcrowding.
3. Any live cell with two or three live neighbours lives on to the next generation.
4. Any dead cell with exactly three live neighbours becomes a live cell.

This movie requires Flash Player 9
Conway

Posted in Actionscript, Cellular Automata, Programming, sketches.

Tagged with , , , .


7 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. MarkSpizer says

    great post as usual
    looking forward to the source code

  2. Alejandro Erickson says

    Very nice. I’m also looking forward to the source.

  3. Deniz Cem Önduygu says

    Hey, why don’t you allow the user to fill pixels with the cursor?

  4. Servet says

    Sheer laziness on my end :) I shall add it before releasing the source, good idea, thanks.

  5. helen says

    hey how do you do the randomise?

  6. Servet says

    Hi Helen,
    I run through the grid with a nested for loop and roll a random, if it is < 0.2 I fill the cell.

    for(var i:Number = 0; i<ROWS-1;i++){
    for(var j:Number = 0;j<COLUMNS-1;j++){
    if(Math.random()<=.2) { fillCell(i,j); }
    }
    }

    ^code might have an issue with the borders and corners, I'll get you the right one when I get back home.

Continuing the Discussion

  1. Conway’s Game of Life – Chaos and Creation Through Simplicity | Apples for Geeks linked to this post on August 13, 2011

    [...] Black and white large version – Larger grid with more options [...]



Some HTML is OK

or, reply to this post via trackback.