Class: Lifelike::LifelikeCellularAutomaton::RuleString
- Inherits:
-
Object
- Object
- Lifelike::LifelikeCellularAutomaton::RuleString
- Defined in:
- lib/lifelike/lifelike_cellular_automaton/rules.rb
Instance Method Summary collapse
- #alive_neighbors_to_be_born ⇒ Object
- #alive_neighbors_to_survive ⇒ Object
-
#initialize(string) ⇒ RuleString
constructor
See: www.conwaylife.com/wiki/Rule#Rules Example: B3/S23.
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_born ⇒ Object
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_survive ⇒ Object
28 29 30 |
# File 'lib/lifelike/lifelike_cellular_automaton/rules.rb', line 28 def alive_neighbors_to_survive numbers_after('S') end |