class Conwy::World::CellGrid::Coordinate
Public Instance Methods
negative?()
click to toggle source
# File lib/conwy/world.rb, line 61 def negative? x < 0 || y < 0 end
neighbors()
click to toggle source
# File lib/conwy/world.rb, line 65 def neighbors neighbor_shifts.map do |x, y| shift(x, y) end end
Private Instance Methods
neighbor_shifts()
click to toggle source
# File lib/conwy/world.rb, line 77 def neighbor_shifts [ [-1, -1], [-1, 0], [-1, 1], [ 0, -1], [ 0, 1], [ 1, -1], [ 1, 0], [ 1, 1], ] end
shift(x_shift, y_shift)
click to toggle source
# File lib/conwy/world.rb, line 73 def shift(x_shift, y_shift) self.class.new(x + x_shift, y + y_shift) end