Class: MyLifeModel

Inherits:
Object
  • Object
show all
Defined in:
lib/life_game_viewer/model/my_life_model.rb

Class Method Summary collapse

Instance Method Summary collapse

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

Returns:

  • (Boolean)


36
37
# File 'lib/life_game_viewer/model/my_life_model.rb', line 36

def alive?(row, col)
end

#column_countObject



33
34
# File 'lib/life_game_viewer/model/my_life_model.rb', line 33

def column_count
end

#next_generation_modelObject



45
46
# File 'lib/life_game_viewer/model/my_life_model.rb', line 45

def next_generation_model
end

#number_livingObject



48
49
# File 'lib/life_game_viewer/model/my_life_model.rb', line 48

def number_living
end

#row_countObject



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_sObject



51
52
# File 'lib/life_game_viewer/model/my_life_model.rb', line 51

def to_s
end