Class: Explosion

Inherits:
Object
  • Object
show all
Defined in:
lib/rrobots/explosion.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bf, x, y) ⇒ Explosion

Returns a new instance of Explosion.



7
8
9
10
# File 'lib/rrobots/explosion.rb', line 7

def initialize bf, x, y
  @x, @y, @t = x, y, 0
  @battlefield, dead = bf, false
end

Instance Attribute Details

#deadObject

Returns the value of attribute dead.



5
6
7
# File 'lib/rrobots/explosion.rb', line 5

def dead
  @dead
end

#tObject

Returns the value of attribute t.



4
5
6
# File 'lib/rrobots/explosion.rb', line 4

def t
  @t
end

#xObject

Returns the value of attribute x.



2
3
4
# File 'lib/rrobots/explosion.rb', line 2

def x
  @x
end

#yObject

Returns the value of attribute y.



3
4
5
# File 'lib/rrobots/explosion.rb', line 3

def y
  @y
end

Instance Method Details

#stateObject



12
13
14
# File 'lib/rrobots/explosion.rb', line 12

def state
  {:x=>x, :y=>y, :t=>t}
end

#tickObject



16
17
18
19
# File 'lib/rrobots/explosion.rb', line 16

def tick
  @t += 1
  @dead ||= t > 15
end