Class: Rubylife::Cell
- Inherits:
-
Object
- Object
- Rubylife::Cell
- Defined in:
- lib/rubylife/cell.rb
Instance Attribute Summary collapse
-
#alive ⇒ Object
Returns the value of attribute alive.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #alive? ⇒ Boolean
- #dead? ⇒ Boolean
-
#initialize(x = 0, y = 0) ⇒ Cell
constructor
A new instance of Cell.
Constructor Details
#initialize(x = 0, y = 0) ⇒ Cell
Returns a new instance of Cell.
5 6 7 8 9 |
# File 'lib/rubylife/cell.rb', line 5 def initialize(x=0, y=0) @x = x @y = y @alive = false end |
Instance Attribute Details
#alive ⇒ Object
Returns the value of attribute alive.
3 4 5 |
# File 'lib/rubylife/cell.rb', line 3 def alive @alive end |
#x ⇒ Object
Returns the value of attribute x.
3 4 5 |
# File 'lib/rubylife/cell.rb', line 3 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
3 4 5 |
# File 'lib/rubylife/cell.rb', line 3 def y @y end |
Instance Method Details
#alive? ⇒ Boolean
11 12 13 |
# File 'lib/rubylife/cell.rb', line 11 def alive? @alive end |
#dead? ⇒ Boolean
15 16 17 |
# File 'lib/rubylife/cell.rb', line 15 def dead? !@alive end |