Class: Rubylife::Cell

Inherits:
Object
  • Object
show all
Defined in:
lib/rubylife/cell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#aliveObject

Returns the value of attribute alive.



3
4
5
# File 'lib/rubylife/cell.rb', line 3

def alive
  @alive
end

#xObject

Returns the value of attribute x.



3
4
5
# File 'lib/rubylife/cell.rb', line 3

def x
  @x
end

#yObject

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

Returns:

  • (Boolean)


11
12
13
# File 'lib/rubylife/cell.rb', line 11

def alive?
	@alive
end

#dead?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/rubylife/cell.rb', line 15

def dead?
	!@alive
end