class GameOfLife::Cell

Attributes

alive[RW]
neighbours[RW]
x[RW]
y[RW]

Public Class Methods

new(x=0,y=0,alive=true) click to toggle source
# File lib/game-of-life/cell.rb, line 4
def initialize(x=0,y=0,alive=true)
  @x,@y = x,y
  @alive = alive
end

Public Instance Methods

==(otherCell) click to toggle source
# File lib/game-of-life/cell.rb, line 9
def ==(otherCell)
  (self.x == otherCell.x) and (self.y == otherCell.y)
end
alive?() click to toggle source
# File lib/game-of-life/cell.rb, line 17
def alive?
  self.alive
end
dead?() click to toggle source
# File lib/game-of-life/cell.rb, line 21
def dead?
  not alive?
end
die!() click to toggle source
# File lib/game-of-life/cell.rb, line 29
def die!
  @alive = false
end
reborn!() click to toggle source
# File lib/game-of-life/cell.rb, line 25
def reborn!
  @alive = true
end