Class: MyLifeModel
- Inherits:
-
Object
- Object
- MyLifeModel
- Defined in:
- lib/life_game_viewer/model/my_life_model.rb
Class Method Summary collapse
-
.create(row_count, column_count) ⇒ Object
This method will create a model with the specified number of rows and columns.
-
.create_from_string(string) ⇒ Object
Creates and returns an instance whose size and values are specified in the passed string.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #alive?(row, col) ⇒ Boolean
- #column_count ⇒ Object
- #next_generation_model ⇒ Object
- #number_living ⇒ Object
- #row_count ⇒ Object
- #set_living_state(row, col, alive) ⇒ Object
- #set_living_states(array_of_row_col_tuples, alive) ⇒ Object
- #to_s ⇒ Object
Class Method Details
.create(row_count, column_count) ⇒ Object
This method will create a model with the specified number of rows and columns. If a block is passed it will be used to initialize the alive/dead values; the block should take params row and column number.
27 28 |
# File 'lib/life_game_viewer/model/my_life_model.rb', line 27 def self.create(row_count, column_count) end |
.create_from_string(string) ⇒ Object
Creates and returns an instance whose size and values are specified in the passed string. Rows must be delimited by “n”. The ‘*’ character represents true, and any other value will evaluate to false.
21 22 |
# File 'lib/life_game_viewer/model/my_life_model.rb', line 21 def self.create_from_string(string) end |
Instance Method Details
#==(other) ⇒ Object
54 55 |
# File 'lib/life_game_viewer/model/my_life_model.rb', line 54 def ==(other) end |
#alive?(row, col) ⇒ Boolean
36 37 |
# File 'lib/life_game_viewer/model/my_life_model.rb', line 36 def alive?(row, col) end |
#column_count ⇒ Object
33 34 |
# File 'lib/life_game_viewer/model/my_life_model.rb', line 33 def column_count end |
#next_generation_model ⇒ Object
45 46 |
# File 'lib/life_game_viewer/model/my_life_model.rb', line 45 def next_generation_model end |
#number_living ⇒ Object
48 49 |
# File 'lib/life_game_viewer/model/my_life_model.rb', line 48 def number_living end |
#row_count ⇒ Object
30 31 |
# File 'lib/life_game_viewer/model/my_life_model.rb', line 30 def row_count end |
#set_living_state(row, col, alive) ⇒ Object
39 40 |
# File 'lib/life_game_viewer/model/my_life_model.rb', line 39 def set_living_state(row, col, alive) end |
#set_living_states(array_of_row_col_tuples, alive) ⇒ Object
42 43 |
# File 'lib/life_game_viewer/model/my_life_model.rb', line 42 def set_living_states(array_of_row_col_tuples, alive) end |
#to_s ⇒ Object
51 52 |
# File 'lib/life_game_viewer/model/my_life_model.rb', line 51 def to_s end |