class Vida::Cell

Attributes

alive[R]
x[R]
y[R]

Public Class Methods

new(args) click to toggle source
# File lib/vida/cell.rb, line 4
def initialize(args)
  @alive  = args.fetch(:alive)
  @x      = args.fetch(:x)
  @y      = args.fetch(:y)
end

Public Instance Methods

to_s() click to toggle source
# File lib/vida/cell.rb, line 14
def to_s
  alive ? 'o' : ' '
end
update_status(live_cells_around) click to toggle source
# File lib/vida/cell.rb, line 10
def update_status(live_cells_around)
  @alive = alive ? (2..3) === live_cells_around : 3 == live_cells_around
end