Skip to content

Instantly share code, notes, and snippets.

Created October 6, 2014 16:52
Show Gist options
  • Save anonymous/edc8b30361cd26919626 to your computer and use it in GitHub Desktop.
Save anonymous/edc8b30361cd26919626 to your computer and use it in GitHub Desktop.
1. type list of coordinates ([10, 10], [10, 11], [10, 12]]) //thos are cells that are alive
2. create dead cells around the alive cells [[10,10,1],[10,11,1],[10,12,1],[9,9,0],[9,10,0],[9,11,0],[10,9,0],[11,9,0],[11,10,0],[11,11,0],[9,12,0],[11,12,0],[9,13,0],[10,13,0],[11,13,0]]
2. Draw
3. Apply Rules simultaneously
loop through INPUT entered in 1. (1<i<3)
a. if ((input is Alive) && (size of neighbourhood of input < 2)) then input[i] die
b. if ((input is Alive) && (size of neighbourhood of input > 3)) then input[i] die
c. if ((input is Dead) && (size of neighbourhood of input == 3)) then input[i] lives on
4. Draw
5. Repeat step 3 and step 4 forever
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment