Cellular Automata – Week #10

https://editor.p5js.org/oae233/sketches/raawVHP82

Concept / Idea

For this assignment, I really struggled to come up with a concept. I also would get stuck for a long time just playing around with the Game of Life demos online ahahah. I found some of them very interesting (like the Gosper glider gun & the concept of gliders in general) I thought about doing something related to gliders, which are basically a setup of cells that forms a loop and moves across the canvas diagonally, but eventually, I felt that visually it wasn’t what I wanted to do. I ended up just loading the Game of Life code from the P5JS website (https://p5js.org/examples/simulate-game-of-life.html) into a sketch of mine and playing around with it. Eventually, I came across some settings I liked.

The initial setup draws this beautiful erupting pattern that eventually descends into chaos. I played around with the rules to create a version that never reaches stability / is in constant motion (I basically added a rule that a dead cell also comes alive it has 4 neighbors) and then added another rule that turns cells with 7 neighbors into a 3rd color. I like the idea of playing with 3 colors In most of my sketches. Finally, the faded background and blur canvas filter help bring the effect together.

For interactivity, I added the ability for users to change the 3 colors of the main sketch, a button to reset the animation, and a slider to control the frame rate.

Some code I want to highlight:

   

if      ((board[x][y] == 1) && (neighbors <  2)) next[x][y] = 0;           // Loneliness

      else if ((board[x][y] == 1) && (neighbors >  3)) next[x][y] = 0; 

       else if ((board[x][y] == 2) && (neighbors >  3)) next[x][y] = 0;

       else if ((board[x][y] == 2) && (neighbors < 2)) next[x][y] = 0;

      

      // Overpopulation

      else if ((board[x][y] == 0) && (neighbors == 3)) next[x][y] = 1; 

      else if ((board[x][y] == 0) && (neighbors == 4)) next[x][y] = 1;    

      

      else if ((board[x][y] == 0) && (neighbors == 7)) next[x][y] = 2;

 

These are all the rules I used

Future work:

I want to add more interactivity to the project, maybe have a couple of different patterns people can choose from or have users be able to draw on the canvas as well.

Leave a Reply

Your email address will not be published. Required fields are marked *