Created
September 6, 2013 08:47
-
-
Save kunjee17/6461208 to your computer and use it in GitHub Desktop.
Game of life in Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
life=->g,s{(0..s*s-1).map{|i|->n{n==3||(g[i]&&n==2)||nil} | |
[[g[i-s-1],g[i-s],g[i-s+1],g[i-1],g[i+1],g[i+s-1],g[i+s],g[i+s+1]] | |
.compact.count]}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment