remove the run method as it is no longer needed, and redo explanation

Umar M. Sheikh 11 年之前
父节点
当前提交
e86e052a71
共有 1 个文件被更改,包括 4 次插入12 次删除
  1. 4 12
      app/models/agents/code_agent.rb

+ 4 - 12
app/models/agents/code_agent.rb

@@ -12,18 +12,11 @@ module Agents
12 12
       You can create events based on your own logic.
13 13
       Specifically, you have the following class, lets say, present is a string "js_code".
14 14
 
15
-          function Agent(m, e, o, agent){
16
-          this.memory = JSON.parse(m);
15
+          function Agent(e, o, agent){
17 16
           this.events = JSON.parse(e);
18 17
           this.options = JSON.parse(o);
19 18
           this.agent = JSON.parse(agent);
20 19
           }
21
-          Agent.prototype.run = function(){
22
-            //Implement me
23
-            // Example create a new event with the following code:
24
-            //var new_event = JSON.stringify({key1: "val1", key2: "val2"});
25
-            //create_event(pd);
26
-          }
27 20
           Agent.prototype.check = function(){
28 21
             // Implement me
29 22
            }
@@ -62,8 +55,6 @@ module Agents
62 55
         return JSON.stringify(mem);
63 56
       }
64 57
     }
65
-    Agent.prototype.run = function(){
66
-    }
67 58
     Agent.prototype.check = function(){
68 59
     }
69 60
     Agent.prototype.receive = function(){
@@ -106,10 +97,11 @@ module Agents
106 97
     end
107 98
 
108 99
     def default_options
109
-      js_code = "Agent.prototype.run = function(){ var pd = JSON.stringify({memory: this.memory(), events: this.events, options: this.options});create_event(pd); };Agent.prototype.check = function(){ var pd = JSON.stringify({memory: this.memory(), events: this.events, options: this.options});create_event(pd); };Agent.prototype.receive = function(){ var pd = JSON.stringify({memory: this.memory(), events: this.events, options: this.options});create_event(pd); }"
100
+      js_code = "Agent.prototype.check = function(){ var pd = JSON.stringify({memory: this.memory(), events: this.events, options: this.options});create_event(pd); };Agent.prototype.receive = function(){ var pd = JSON.stringify({memory: this.memory(), events: this.events, options: this.options});create_event(pd); }"
110 101
       {
111 102
         "code" => js_code,
112
-        'expected_receive_period_in_days' => "2"
103
+        'expected_receive_period_in_days' => "2",
104
+        'expected_update_period_in_days' => "2"
113 105
       }
114 106
     end
115 107
   end