Class: Conway::Rules::Reproduction

Inherits:
Object
  • Object
show all
Includes:
MemoizedCells, LiveCount
Defined in:
lib/conway/rules/reproduction.rb

Instance Method Summary collapse

Methods included from MemoizedCells

#dead_cell, #live_cell

Instance Method Details

#apply(cell, neighbors) ⇒ Object



9
10
11
12
# File 'lib/conway/rules/reproduction.rb', line 9

def apply(cell, neighbors)
  count = live_count(neighbors)
  live_cell unless cell.alive? || fewer_or_greater_than_three?(count)
end