Class: RubyWarrior::Turn

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_warrior/turn.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(abilities) ⇒ Turn

Returns a new instance of Turn.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ruby_warrior/turn.rb', line 5

def initialize(abilities)
  @action = nil
  @senses = {}
  
  abilities.each do |name, sense|
    if name.to_s =~ /\!$/
      add_action(name)
    else
      add_sense(name, sense)
    end
  end
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



3
4
5
# File 'lib/ruby_warrior/turn.rb', line 3

def action
  @action
end