Created
September 28, 2012 16:24
-
-
Save carlism/3800774 to your computer and use it in GitHub Desktop.
Game Of Life Neighborhood
This file contains 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
def neighborhood | |
n = [] | |
[-1,0,1].each {|y_adj| | |
[-1,0,1].each {|x_adj| | |
n << [@x + x_adj, @y + y_adj] | |
} | |
} | |
n.delete_at(4) | |
n | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment