Method: Conway::Point#adjacents

Defined in:
lib/conway/point.rb

#adjacentsObject



29
30
31
32
33
34
35
36
# File 'lib/conway/point.rb', line 29

def adjacents
  @adjacents ||=
  (-1..1).map do |j|
    (-1..1).map do |i|
      Point.new(x+i, y+j) unless i == 0 && j == 0
    end
  end.flatten.compact
end