Class: Lifelike::LifelikeCellularAutomaton::RuleString

Inherits:
Object
  • Object
show all
Defined in:
lib/lifelike/lifelike_cellular_automaton/rules.rb

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ RuleString

See: www.conwaylife.com/wiki/Rule#Rules Example: B3/S23



20
21
22
# File 'lib/lifelike/lifelike_cellular_automaton/rules.rb', line 20

def initialize(string)
  @string = string
end

Instance Method Details

#alive_neighbors_to_be_bornObject



24
25
26
# File 'lib/lifelike/lifelike_cellular_automaton/rules.rb', line 24

def alive_neighbors_to_be_born
  numbers_after('B')
end

#alive_neighbors_to_surviveObject



28
29
30
# File 'lib/lifelike/lifelike_cellular_automaton/rules.rb', line 28

def alive_neighbors_to_survive
  numbers_after('S')
end