Menu

Conway's Game Of Life

Home / portfolio / Conway's Game Of Life

Conway's Game Of Life

"The Game of Life (sometimes known simply as Life) is an example of a cellular automaton and a zero-player game. It takes place on an infinite two-dimensional grid in which cells can be ‘on’ (alive) or ‘off’ (dead), and is defined by a set of rules that jointly determine the state of a cell given the state of its neighbours." http://www.scholarpedia.org/article/Game_of_Life


The idea was to remake the simulation made by Dr. John H Conway in a weeks time. With that we got a explanation on how to simulation works and some mathematics aroudn it. I made an efficcient version that runs smoothly via unity and works exactly as the original.


img-Image


This piece of code check the amout of neighbors the specific cell has and how many of those are alive. First it checks all the possible positions with the 2 arrays called "_optionArrayX" and "_optionArrayY". For al lthe possible combinations the cell will check if the neighboring cells are alive or dead and execute the corresponding actions.



img-Image


This function will set for the total width and height of the gid where you are simulating all the cells on or off. This will edit the sprite editor to change the visual of the cells to show what cells are alive or dead. If the cells are alive or not is remembered by the "_activeCells" array and set into the "_cellGrid" array to show which cells visuals are being changed.


If you enjoyed this read or have questions feel free to contact me!

Download/View project

Share