class Cell
Attributes
alive[R]
neighbors[RW]
Public Class Methods
new()
click to toggle source
# File lib/cell.rb, line 5 def initialize @alive = (rand(0..1) == 1) ? true : false end
Public Instance Methods
next!()
click to toggle source
# File lib/cell.rb, line 9 def next! @alive = @alive ? (2..3) === @neighbors : 3 == @neighbors end
to_i()
click to toggle source
# File lib/cell.rb, line 13 def to_i @alive ? 1 : 0 end