lib/demiurge/agent.rb
# An action being pulled from the action queue is offered normally.
An action being pulled from the action queue is offered normally.
An action being pulled from the action queue is offered normally .
def offer
      if @agent.state["busy"] > 0
        self.cancel "Agent #{@name.inspect} was too busy to act (#{@agent.state["busy"]}).", "silent" => "true"
        return
      elsif @agent.state["queued_actions"].empty?
        self.cancel "Agent #{@name.inspect} had no actions during the 'offer' phase.", "silent" => "true"
        return
      end
      action = @agent.state["queued_actions"][0]
      @action_name, @action_args, @action_queue_number = *action
      @action_struct = @agent.get_action(@action_name)
      super
    end
def offer if @agent . state [ "busy" ] > 0 self . cancel "Agent #{@name.inspect} was too busy to act (#{@agent.state["busy"]})." , "silent" => "true" return elsif @agent . state [ "queued_actions" ] . empty? self . cancel "Agent #{@name.inspect} had no actions during the 'offer' phase." , "silent" => "true" return end action = @agent . state [ "queued_actions" ] [ 0 ] @action_name , @action_args , @action_queue_number = * action @action_struct = @agent . get_action ( @action_name ) super end
An action being pulled from the action queue is offered normally.
An action being pulled from the action queue is offered normally .
# Don't offer the action if it's going to be a no-op. # See comment on "silent" in #allowed? below. # Now offer the agent's action via the usual channels