[Avida-cvs] [avida-svn] r500 - development/source/main

brysonda@myxo.css.msu.edu brysonda at myxo.css.msu.edu
Thu Mar 9 19:55:48 PST 2006


Author: brysonda
Date: 2006-03-09 22:55:47 -0500 (Thu, 09 Mar 2006)
New Revision: 500

Modified:
   development/source/main/cEnvironment.cc
   development/source/main/cTaskEntry.h
   development/source/main/cTaskLib.cc
   development/source/main/cTaskLib.h
Log:
Rework cTaskLib to create and use a cTaskContext, rather than copying values into mutable data members.  Optimization may be possible, as copying the buffers is probably not necessary.  cTaskContext is basically just a direct wrapper around the former mutable data members at this time.

Modified: development/source/main/cEnvironment.cc
===================================================================
--- development/source/main/cEnvironment.cc	2006-03-09 21:48:04 UTC (rev 499)
+++ development/source/main/cEnvironment.cc	2006-03-10 03:55:47 UTC (rev 500)
@@ -664,7 +664,7 @@
 			       const tList< tBuffer<int> > & output_buffers) const
 {
   // Do setup for reaction tests...
-  task_lib.SetupTests(input_buf, output_buf, input_buffers, output_buffers);
+  cTaskContext* taskctx = task_lib.SetupTests(input_buf, output_buf, input_buffers, output_buffers);
 
   // Loop through all reactions to see if any have been triggered...
   const int num_reactions = reaction_lib.GetSize();
@@ -678,7 +678,7 @@
     // Examine the task trigger associated with this reaction
     cTaskEntry * cur_task = cur_reaction->GetTask();
     assert(cur_task != NULL);
-    const double task_quality = task_lib.TestOutput(*cur_task);
+    const double task_quality = task_lib.TestOutput(*cur_task, taskctx);
     const int task_id = cur_task->GetID();
 
     // If this task wasn't performed, move on to the next one.
@@ -694,8 +694,7 @@
     }
 
     // And lets process it!
-    DoProcesses(cur_reaction->GetProcesses(), resource_count,
-		task_quality, result);
+    DoProcesses(cur_reaction->GetProcesses(), resource_count, task_quality, result);
 
     // Mark this reaction as occuring...
     result.MarkReaction(cur_reaction->GetID());
@@ -705,8 +704,7 @@
   // if (receive_buf.GetSize() != 0)
   {
     // Do setup for reaction tests...
-    task_lib.
-      SetupTests(receive_buf, output_buf, input_buffers, output_buffers);
+    taskctx = task_lib.SetupTests(receive_buf, output_buf, input_buffers, output_buffers);
 
     for (int i = 0; i < num_reactions; i++) {
       cReaction * cur_reaction = reaction_lib.GetReaction(i);
@@ -718,7 +716,7 @@
       // Examine the task trigger associated with this reaction
       cTaskEntry * cur_task = cur_reaction->GetTask();
       assert(cur_task != NULL);
-      const double task_quality = task_lib.TestOutput(*cur_task);
+      const double task_quality = task_lib.TestOutput(*cur_task, taskctx);
       const int task_id = cur_task->GetID();
       
       // If this task wasn't performed, move on to the next one.

Modified: development/source/main/cTaskEntry.h
===================================================================
--- development/source/main/cTaskEntry.h	2006-03-09 21:48:04 UTC (rev 499)
+++ development/source/main/cTaskEntry.h	2006-03-10 03:55:47 UTC (rev 500)
@@ -18,6 +18,11 @@
 #include "cTaskLib.h"
 #endif
 
+class cTaskLib;
+class cTaskContext;
+
+typedef double (cTaskLib::*tTaskTest)(cTaskContext*) const;
+
 class cTaskEntry
 {
 private:

Modified: development/source/main/cTaskLib.cc
===================================================================
--- development/source/main/cTaskLib.cc	2006-03-09 21:48:04 UTC (rev 499)
+++ development/source/main/cTaskLib.cc	2006-03-10 03:55:47 UTC (rev 500)
@@ -10,8 +10,6 @@
 
 #include "cTaskLib.h"
 
-#include "cTaskEntry.h"
-
 extern "C" {
 #include <math.h>
 #include <limits.h>
@@ -21,10 +19,8 @@
 
 
 cTaskLib::cTaskLib()
-  : use_neighbor_input(false)
-  , use_neighbor_output(false)
-  , input_buffer(3)
-  , output_buffer(3)
+: use_neighbor_input(false)
+, use_neighbor_output(false)
 {
 }
 
@@ -53,14 +49,14 @@
       return task_array[i];
     }
   }
-
+  
   // Match up this name to its corresponding task
   const int start_size = task_array.GetSize();
-
+  
   if (name == "echo")      NewTask(name, "Echo", &cTaskLib::Task_Echo);
   else if (name == "add")  NewTask(name, "Add",  &cTaskLib::Task_Add);
   else if (name == "sub")  NewTask(name, "Sub",  &cTaskLib::Task_Sub);
-
+  
   else if (name == "not")   NewTask(name, "Not",    &cTaskLib::Task_Not);
   else if (name == "nand")  NewTask(name, "Nand",   &cTaskLib::Task_Nand);
   else if (name == "and")   NewTask(name, "And",    &cTaskLib::Task_And);
@@ -70,7 +66,7 @@
   else if (name == "nor")   NewTask(name, "Nor",    &cTaskLib::Task_Nor);
   else if (name == "xor")   NewTask(name, "Xor",    &cTaskLib::Task_Xor);
   else if (name == "equ")   NewTask(name, "Equals", &cTaskLib::Task_Equ);
-
+  
   else if (name == "logic_3AA")
     NewTask(name, "Logic 3AA (A+B+C == 0)", &cTaskLib::Task_Logic3in_AA);
   else if (name == "logic_3AB")
@@ -207,7 +203,7 @@
     NewTask(name, "Logic 3CO", &cTaskLib::Task_Logic3in_CO);
   else if (name == "logic_3CP")
     NewTask(name, "Logic 3CP", &cTaskLib::Task_Logic3in_CP);
-
+  
   else if (name == "math_1AA")
     NewTask(name, "Math 1AA (2X)", &cTaskLib::Task_Math1in_AA);
   else if (name == "math_1AB")
@@ -240,7 +236,7 @@
     NewTask(name, "Math 1AO (X-6)", &cTaskLib::Task_Math1in_AO);  
   else if (name == "math_1AP")
     NewTask(name, "Math 1AP (X-7)", &cTaskLib::Task_Math1in_AP);  
-
+  
   else if (name == "math_2AA")
     NewTask(name, "Math 2AA (sqrt(X+Y))", &cTaskLib::Task_Math2in_AA);  
   else if (name == "math_2AB")
@@ -285,7 +281,7 @@
     NewTask(name, "Math 2AU (2X+3Y)", &cTaskLib::Task_Math2in_AU);
   else if (name == "math_2AV")
     NewTask(name, "Math 2AV (XY^2)", &cTaskLib::Task_Math2in_AV);
-
+  
   else if (name == "math_3AA")
     NewTask(name, "Math 3AA (X^2+Y^2+Z^2)", &cTaskLib::Task_Math3in_AA);  
   else if (name == "math_3AB")
@@ -293,11 +289,11 @@
   else if (name == "math_3AC")
     NewTask(name, "Math 3AC (X+2Y+3Z)", &cTaskLib::Task_Math3in_AC);  
   /*
-  Visual Studio.net 2003 gives compiler error:
-    fatal error C1061: compiler limit : blocks nested too deeply
-  Sherri fixed this by removing the 'else' in the next line.
-  -- K
-  */
+   Visual Studio.net 2003 gives compiler error:
+   fatal error C1061: compiler limit : blocks nested too deeply
+   Sherri fixed this by removing the 'else' in the next line.
+   -- K
+   */
   //else if (name == "math_3AD")
   //  NewTask(name, "Math 3AD (XY^2+Z^3)", &cTaskLib::Task_Math3in_AD); 
   if (name == "math_3AD")
@@ -314,29 +310,29 @@
     NewTask(name, "Math 3AI (-X-Y-Z)", &cTaskLib::Task_Math3in_AI);  
   else if (name == "math_3AJ")
     NewTask(name, "Math 3AJ ((X-Y)^2+(Y-Z)^2+(Z-X)^2)",
-	    &cTaskLib::Task_Math3in_AJ);  
+            &cTaskLib::Task_Math3in_AJ);  
   else if (name == "math_3AK")
     NewTask(name, "Math 3AK ((X+Y)^2+(Y+Z)^2+(Z+X)^2)",
-	    &cTaskLib::Task_Math3in_AK);  
+            &cTaskLib::Task_Math3in_AK);  
   else if (name == "math_3AL")
     NewTask(name, "Math 3AL ((X-Y)^2+(X-Z)^2)", &cTaskLib::Task_Math3in_AL);  
   else if (name == "math_3AM")
     NewTask(name, "Math 3AM ((X+Y)^2+(Y+Z)^2)", &cTaskLib::Task_Math3in_AM);  
-    
+  
 	// communication tasks
   else if (name == "comm_echo")
     NewTask(name, "Echo of Neighbor's Input", &cTaskLib::Task_CommEcho,
-	    REQ_NEIGHBOR_INPUT);
+            REQ_NEIGHBOR_INPUT);
   else if (name == "comm_not")
 	  NewTask(name, "Not of Neighbor's INput", &cTaskLib::Task_CommNot,
-		REQ_NEIGHBOR_INPUT);
+            REQ_NEIGHBOR_INPUT);
   // Make sure we have actually found a task.
-
+  
   if (task_array.GetSize() == start_size) {
     cerr << "Unknown task entry '" << name << "'." << endl;
     return NULL;
   }
-
+  
   // And return the found task.
   return task_array[start_size];
 }
@@ -345,32 +341,19 @@
 {
   return *(task_array[id]);
 }
-  
-void cTaskLib::SetupTests(const tBuffer<int> & inputs,
-			  const tBuffer<int> & outputs,
-			  const tList<tBuffer<int> > & other_inputs,
-			  const tList<tBuffer<int> > & other_outputs) const
-{
-  input_buffer = inputs;
-  output_buffer = outputs;
-  other_input_buffers.Copy(other_inputs);
-  other_output_buffers.Copy(other_outputs);
 
-  SetupLogicTests(inputs, outputs);
-}
-
-void cTaskLib::SetupLogicTests(const tBuffer<int> & inputs,
-			       const tBuffer<int> & outputs) const
+int cTaskLib::SetupLogicTests(const tBuffer<int> & inputs,
+                              const tBuffer<int> & outputs) const
 {
   // Collect the inputs in a useful form.
-  const int num_inputs = input_buffer.GetNumStored();
+  const int num_inputs = inputs.GetNumStored();
   int test_inputs[3];
   for (int i = 0; i < 3; i++) {
-    test_inputs[i] = (num_inputs > i) ? input_buffer[i] : 0;
+    test_inputs[i] = (num_inputs > i) ? inputs[i] : 0;
   }
-  int test_output = output_buffer[0];
-
-
+  int test_output = outputs[0];
+  
+  
   // Setup logic_out to test the output for each logical combination...
   // Assuming each bit in logic out to be based on the inputs:
   //
@@ -378,18 +361,18 @@
   //       Input C: 1 1 1 1 0 0 0 0
   //       Input B: 1 1 0 0 1 1 0 0
   //       Input A: 1 0 1 0 1 0 1 0
-
+  
   tArray<int> logic_out(8);
   logic_out.SetAll(-1);
- 
+  
   // Test all input combos!
   bool func_OK = true;  // Have all outputs been consistant?
   for (int test_pos = 0; test_pos < 32; test_pos++) {
     int logic_pos = 0;
     for (int i = 0; i < 3; i++)  logic_pos += (test_inputs[i] & 1) << i;
-
+    
     if ( logic_out[logic_pos] != -1 &&
-	 logic_out[logic_pos] != (test_output & 1) ) {
+         logic_out[logic_pos] != (test_output & 1) ) {
       func_OK = false;
       break;
     }
@@ -400,13 +383,10 @@
     test_output >>= 1;
     for (int i = 0; i < 3; i++) test_inputs[i] >>= 1;
   }
-
+  
   // If there were any inconsistancies, deal with them.
-  if (func_OK == false) {
-    logic_id = -1;
-    return;
-  }
-
+  if (func_OK == false) return -1;
+  
   // Determine the logic ID number of this task.
   if (num_inputs < 1) {  // 000 -> 001
     logic_out[1] = logic_out[0];
@@ -421,7 +401,7 @@
     logic_out[6] = logic_out[2];
     logic_out[7] = logic_out[3];
   }
-
+  
   // Lets just make sure we've gotten this correct...
   assert(logic_out[0] >= 0 && logic_out[0] <= 1);
   assert(logic_out[1] >= 0 && logic_out[1] <= 1);
@@ -431,40 +411,36 @@
   assert(logic_out[5] >= 0 && logic_out[5] <= 1);
   assert(logic_out[6] >= 0 && logic_out[6] <= 1);
   assert(logic_out[7] >= 0 && logic_out[7] <= 1);
-
-  logic_id = 0;
-  for (int i = 0; i < 8; i++) logic_id += logic_out[i] << i;
+  
+  int logicid = 0;
+  for (int i = 0; i < 8; i++) logicid += logic_out[i] << i;
+  
+  return logicid;
 }
 
 
-double cTaskLib::TestOutput(const cTaskEntry & task) const
-{
-  tTaskTest test_fun = task.GetTestFun();
-  return (this->*test_fun)();
-}
-
-
 ////////////////////////
 //  cTaskLib (private)
 ////////////////////////
 
 void cTaskLib::NewTask(const cString & name, const cString & desc,
-		       tTaskTest task_fun, int reqs)
+                       tTaskTest task_fun, int reqs)
 {
   if (reqs & REQ_NEIGHBOR_INPUT == true) use_neighbor_input = true;
   if (reqs & REQ_NEIGHBOR_OUTPUT == true) use_neighbor_output = true;
-
+  
   const int id = task_array.GetSize();
   task_array.Resize(id+1);
   task_array[id] = new cTaskEntry(name, desc, id, task_fun);
 }
 
 
-double cTaskLib::Task_Echo() const
+double cTaskLib::Task_Echo(cTaskContext* ctx) const
 {
-  const int test_output = output_buffer[0];
-  for (int i = 0; i < input_buffer.GetNumStored(); i++) {
-    if (input_buffer[i] == test_output) {
+  const int test_output = ctx->output_buffer[0];
+  const int logic_id = ctx->logic_id;
+  for (int i = 0; i < ctx->input_buffer.GetNumStored(); i++) {
+    if (ctx->input_buffer[i] == test_output) {
       assert(logic_id == 170 || logic_id == 204 || logic_id == 240);
       return 1.0;
     }
@@ -473,1210 +449,1287 @@
 }
 
 
-double cTaskLib::Task_Add() const
+double cTaskLib::Task_Add(cTaskContext* ctx) const
 {
-  const int test_output = output_buffer[0];
-  for (int i = 0; i < input_buffer.GetNumStored(); i++) {
+  const int test_output = ctx->output_buffer[0];
+  for (int i = 0; i < ctx->input_buffer.GetNumStored(); i++) {
     for (int j = 0; j < i; j++) {
-      if (test_output == input_buffer[i] + input_buffer[j]) return 1.0;
+      if (test_output == ctx->input_buffer[i] + ctx->input_buffer[j]) return 1.0;
     }
   }
   return 0.0;
 }
 
 
-double cTaskLib::Task_Sub() const
+double cTaskLib::Task_Sub(cTaskContext* ctx) const
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == input_buffer[i] - input_buffer[j]) return 1.0;
+      if (test_output == ctx->input_buffer[i] - ctx->input_buffer[j]) return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Not() const
+double cTaskLib::Task_Not(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 15 || logic_id == 51 || logic_id == 85) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Nand() const
+double cTaskLib::Task_Nand(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 63 || logic_id == 95 || logic_id == 119) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_And() const
+double cTaskLib::Task_And(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 136 || logic_id == 160 || logic_id == 192) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_OrNot() const
+double cTaskLib::Task_OrNot(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 175 || logic_id == 187 || logic_id == 207 ||
       logic_id == 221 || logic_id == 243 || logic_id == 245) return 1.0;
-
+  
   return 0.0;
 }
 
-double cTaskLib::Task_Or() const
+double cTaskLib::Task_Or(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 238 || logic_id == 250 || logic_id == 252) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_AndNot() const
+double cTaskLib::Task_AndNot(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 10 || logic_id == 12 || logic_id == 34 ||
       logic_id == 48 || logic_id == 68 || logic_id == 80) return 1.0;
-
+  
   return 0.0;
 }
 
-double cTaskLib::Task_Nor() const
+double cTaskLib::Task_Nor(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 3 || logic_id == 5 || logic_id == 17) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Xor() const
+double cTaskLib::Task_Xor(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 60 || logic_id == 90 || logic_id == 102) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Equ() const
+double cTaskLib::Task_Equ(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 153 || logic_id == 165 || logic_id == 195) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AA() const
+double cTaskLib::Task_Logic3in_AA(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 1) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AB() const
+double cTaskLib::Task_Logic3in_AB(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 22) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AC() const
+double cTaskLib::Task_Logic3in_AC(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 23) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AD() const
+double cTaskLib::Task_Logic3in_AD(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 104) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AE() const
+double cTaskLib::Task_Logic3in_AE(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 105) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AF() const
+double cTaskLib::Task_Logic3in_AF(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 126) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AG() const
+double cTaskLib::Task_Logic3in_AG(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 127) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AH() const
+double cTaskLib::Task_Logic3in_AH(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 128) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AI() const
+double cTaskLib::Task_Logic3in_AI(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 129) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AJ() const
+double cTaskLib::Task_Logic3in_AJ(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 150) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AK() const
+double cTaskLib::Task_Logic3in_AK(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 151) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AL() const
+double cTaskLib::Task_Logic3in_AL(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 232) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AM() const
+double cTaskLib::Task_Logic3in_AM(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 233) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AN() const
+double cTaskLib::Task_Logic3in_AN(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 254) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AO() const
+double cTaskLib::Task_Logic3in_AO(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 2 || logic_id == 4 || logic_id == 16) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AP() const
+double cTaskLib::Task_Logic3in_AP(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 6 || logic_id == 18 || logic_id == 20) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AQ() const
+double cTaskLib::Task_Logic3in_AQ(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 7 || logic_id == 19 || logic_id == 21) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AR() const
+double cTaskLib::Task_Logic3in_AR(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 8 || logic_id == 32 || logic_id == 64) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AS() const
+double cTaskLib::Task_Logic3in_AS(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 9 || logic_id == 33 || logic_id == 65) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AT() const
+double cTaskLib::Task_Logic3in_AT(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 14 || logic_id == 50 || logic_id == 84) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AU() const
+double cTaskLib::Task_Logic3in_AU(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 24 || logic_id == 36 || logic_id == 66) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AV() const
+double cTaskLib::Task_Logic3in_AV(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 25 || logic_id == 37 || logic_id == 67) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AW() const
+double cTaskLib::Task_Logic3in_AW(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 30 || logic_id == 54 || logic_id == 86) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AX() const
+double cTaskLib::Task_Logic3in_AX(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 31 || logic_id == 55 || logic_id == 87) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AY() const
+double cTaskLib::Task_Logic3in_AY(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 40 || logic_id == 72 || logic_id == 96) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_AZ() const
+double cTaskLib::Task_Logic3in_AZ(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 41 || logic_id == 73 || logic_id == 97) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BA() const
+double cTaskLib::Task_Logic3in_BA(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 42 || logic_id == 76 || logic_id == 112) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BB() const
+double cTaskLib::Task_Logic3in_BB(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 43 || logic_id == 77 || logic_id == 113) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BC() const
+double cTaskLib::Task_Logic3in_BC(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 61 || logic_id == 91 || logic_id == 103) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BD() const
+double cTaskLib::Task_Logic3in_BD(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 62 || logic_id == 94 || logic_id == 118) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BE() const
+double cTaskLib::Task_Logic3in_BE(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 106 || logic_id == 108 || logic_id == 120) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BF() const
+double cTaskLib::Task_Logic3in_BF(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 107 || logic_id == 109 || logic_id == 121) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BG() const
+double cTaskLib::Task_Logic3in_BG(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 110 || logic_id == 122 || logic_id == 124) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BH() const
+double cTaskLib::Task_Logic3in_BH(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 111 || logic_id == 123 || logic_id == 125) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BI() const
+double cTaskLib::Task_Logic3in_BI(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 130 || logic_id == 132 || logic_id == 144) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BJ() const
+double cTaskLib::Task_Logic3in_BJ(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 131 || logic_id == 133 || logic_id == 145) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BK() const
+double cTaskLib::Task_Logic3in_BK(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 134 || logic_id == 146 || logic_id == 148) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BL() const
+double cTaskLib::Task_Logic3in_BL(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 135 || logic_id == 147 || logic_id == 149) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BM() const
+double cTaskLib::Task_Logic3in_BM(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 137 || logic_id == 161 || logic_id == 193) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BN() const
+double cTaskLib::Task_Logic3in_BN(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 142 || logic_id == 178 || logic_id == 212) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BO() const
+double cTaskLib::Task_Logic3in_BO(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 143 || logic_id == 179 || logic_id == 213) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BP() const
+double cTaskLib::Task_Logic3in_BP(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 152 || logic_id == 164 || logic_id == 194) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BQ() const
+double cTaskLib::Task_Logic3in_BQ(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 158 || logic_id == 182 || logic_id == 214) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BR() const
+double cTaskLib::Task_Logic3in_BR(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 159 || logic_id == 183 || logic_id == 215) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BS() const
+double cTaskLib::Task_Logic3in_BS(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 168 || logic_id == 200 || logic_id == 224) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BT() const
+double cTaskLib::Task_Logic3in_BT(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 169 || logic_id == 201 || logic_id == 225) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BU() const
+double cTaskLib::Task_Logic3in_BU(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 171 || logic_id == 205 || logic_id == 241) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BV() const
+double cTaskLib::Task_Logic3in_BV(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 188 || logic_id == 218 || logic_id == 230) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BW() const
+double cTaskLib::Task_Logic3in_BW(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 189 || logic_id == 219 || logic_id == 231) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BX() const
+double cTaskLib::Task_Logic3in_BX(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 190 || logic_id == 222 || logic_id == 246) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BY() const
+double cTaskLib::Task_Logic3in_BY(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 191 || logic_id == 223 || logic_id == 247) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_BZ() const
+double cTaskLib::Task_Logic3in_BZ(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 234 || logic_id == 236 || logic_id == 248) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CA() const
+double cTaskLib::Task_Logic3in_CA(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 235 || logic_id == 237 || logic_id == 249) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CB() const
+double cTaskLib::Task_Logic3in_CB(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 239 || logic_id == 251 || logic_id == 253) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CC() const
+double cTaskLib::Task_Logic3in_CC(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 11 || logic_id == 13 || logic_id == 35 ||
       logic_id == 49 || logic_id == 69 || logic_id == 81) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CD() const
+double cTaskLib::Task_Logic3in_CD(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 26 || logic_id == 28 || logic_id == 38 ||
       logic_id == 52 || logic_id == 70 || logic_id == 82) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CE() const
+double cTaskLib::Task_Logic3in_CE(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 27 || logic_id == 29 || logic_id == 39 ||
       logic_id == 53 || logic_id == 71 || logic_id == 83) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CF() const
+double cTaskLib::Task_Logic3in_CF(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 44 || logic_id == 56 || logic_id == 74 ||
       logic_id == 88 || logic_id == 98 || logic_id == 100) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CG() const
+double cTaskLib::Task_Logic3in_CG(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 45 || logic_id == 57 || logic_id == 75 ||
       logic_id == 89 || logic_id == 99 || logic_id == 101) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CH() const
+double cTaskLib::Task_Logic3in_CH(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 46 || logic_id == 58 || logic_id == 78 ||
       logic_id == 92 || logic_id == 114 || logic_id == 116) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CI() const
+double cTaskLib::Task_Logic3in_CI(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 47 || logic_id == 59 || logic_id == 79 ||
       logic_id == 93 || logic_id == 115 || logic_id == 117) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CJ() const
+double cTaskLib::Task_Logic3in_CJ(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 138 || logic_id == 140 || logic_id == 162 ||
       logic_id == 176 || logic_id == 196 || logic_id == 208) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CK() const
+double cTaskLib::Task_Logic3in_CK(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 139 || logic_id == 141 || logic_id == 163 ||
       logic_id == 177 || logic_id == 197 || logic_id == 209) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CL() const
+double cTaskLib::Task_Logic3in_CL(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 154 || logic_id == 156 || logic_id == 166 ||
       logic_id == 180 || logic_id == 198 || logic_id == 210) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CM() const
+double cTaskLib::Task_Logic3in_CM(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 155 || logic_id == 157 || logic_id == 167 ||
       logic_id == 181 || logic_id == 199 || logic_id == 211) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CN() const
+double cTaskLib::Task_Logic3in_CN(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 172 || logic_id == 184 || logic_id == 202 ||
       logic_id == 216 || logic_id == 226 || logic_id == 228) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CO() const
+double cTaskLib::Task_Logic3in_CO(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 173 || logic_id == 185 || logic_id == 203 ||
       logic_id == 217 || logic_id == 227 || logic_id == 229) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Logic3in_CP() const
+double cTaskLib::Task_Logic3in_CP(cTaskContext* ctx) const
 {
+  const int logic_id = ctx->logic_id;
   if (logic_id == 174 || logic_id == 186 || logic_id == 206 ||
       logic_id == 220 || logic_id == 242 || logic_id == 244) return 1.0;
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AA() const //(2X)
+double cTaskLib::Task_Math1in_AA(cTaskContext* ctx) const //(2X)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
-    if (test_output == 2 * input_buffer[i]) return 1.0;
+    if (test_output == 2 * ctx->input_buffer[i]) return 1.0;
   }
   return 0.0; 
 }
 
-double cTaskLib::Task_Math1in_AB() const //(2X/3)
+double cTaskLib::Task_Math1in_AB(cTaskContext* ctx) const //(2X/3)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == 2 * input_buffer[i] / 3) return 1.0;
+    if (test_output == 2 * ctx->input_buffer[i] / 3) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AC() const //(5X/4)
+double cTaskLib::Task_Math1in_AC(cTaskContext* ctx) const //(5X/4)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == 5 * input_buffer[i] / 4) return 1.0;
+    if (test_output == 5 * ctx->input_buffer[i] / 4) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AD() const //(X^2)
+double cTaskLib::Task_Math1in_AD(cTaskContext* ctx) const //(X^2)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == input_buffer[i] * input_buffer[i]) return 1.0;
+    if (test_output == ctx->input_buffer[i] * ctx->input_buffer[i]) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AE() const //(X^3)
+double cTaskLib::Task_Math1in_AE(cTaskContext* ctx) const //(X^3)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == input_buffer[i] * input_buffer[i] * input_buffer[i])
+    if (test_output == ctx->input_buffer[i] * ctx->input_buffer[i] * ctx->input_buffer[i])
       return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AF() const //(sqrt(X)
+double cTaskLib::Task_Math1in_AF(cTaskContext* ctx) const //(sqrt(X)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == (int) sqrt((double) abs(input_buffer[i]))) return 1.0;
+    if (test_output == (int) sqrt((double) abs(ctx->input_buffer[i]))) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AG() const //(log(X))
+double cTaskLib::Task_Math1in_AG(cTaskContext* ctx) const //(log(X))
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (input_buffer[i] <= 0) continue;
-    if (test_output == (int) log((double) input_buffer[i])) return 1.0;
+    if (ctx->input_buffer[i] <= 0) continue;
+    if (test_output == (int) log((double) ctx->input_buffer[i])) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AH() const //(X^2+X^3)
+double cTaskLib::Task_Math1in_AH(cTaskContext* ctx) const //(X^2+X^3)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == input_buffer[i] * input_buffer[i] + input_buffer[i] * input_buffer[i] * input_buffer[i])
+    if (test_output == ctx->input_buffer[i] * ctx->input_buffer[i] + ctx->input_buffer[i] * ctx->input_buffer[i] * ctx->input_buffer[i])
       return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AI() const // (X^2 + sqrt(X))
+double cTaskLib::Task_Math1in_AI(cTaskContext* ctx) const // (X^2 + sqrt(X))
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == input_buffer[i] * input_buffer[i] + (int) sqrt((double) abs(input_buffer[i]))) 
+    if (test_output == ctx->input_buffer[i] * ctx->input_buffer[i] + (int) sqrt((double) abs(ctx->input_buffer[i]))) 
       return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AJ() const // abs(X)
+double cTaskLib::Task_Math1in_AJ(cTaskContext* ctx) const // abs(X)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == abs(input_buffer[i])) return 1.0;
+    if (test_output == abs(ctx->input_buffer[i])) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AK() const //(X-5)
+double cTaskLib::Task_Math1in_AK(cTaskContext* ctx) const //(X-5)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == input_buffer[i] - 5) return 1.0;
+    if (test_output == ctx->input_buffer[i] - 5) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AL() const //(-X)
+double cTaskLib::Task_Math1in_AL(cTaskContext* ctx) const //(-X)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == 0 - input_buffer[i]) return 1.0;
+    if (test_output == 0 - ctx->input_buffer[i]) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AM() const //(5X)
+double cTaskLib::Task_Math1in_AM(cTaskContext* ctx) const //(5X)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == 5 * input_buffer[i]) return 1.0;
+    if (test_output == 5 * ctx->input_buffer[i]) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AN() const //(X/4)
+double cTaskLib::Task_Math1in_AN(cTaskContext* ctx) const //(X/4)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == input_buffer[i] / 4) return 1.0;
+    if (test_output == ctx->input_buffer[i] / 4) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AO() const //(X-6)
+double cTaskLib::Task_Math1in_AO(cTaskContext* ctx) const //(X-6)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == input_buffer[i] - 6) return 1.0;
+    if (test_output == ctx->input_buffer[i] - 6) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math1in_AP() const //(X-7)
+double cTaskLib::Task_Math1in_AP(cTaskContext* ctx) const //(X-7)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
-    if (test_output == input_buffer[i] - 7) return 1.0;
+    if (test_output == ctx->input_buffer[i] - 7) return 1.0;
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AA() const //(sqrt(X+Y))
+double cTaskLib::Task_Math2in_AA(cTaskContext* ctx) const //(sqrt(X+Y))
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == (int) sqrt((double) abs(input_buffer[i] + input_buffer[j])))
-	return 1.0;
+      if (test_output == (int) sqrt((double) abs(ctx->input_buffer[i] + ctx->input_buffer[j])))
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AB() const  //((X+Y)^2)
+double cTaskLib::Task_Math2in_AB(cTaskContext* ctx) const  //((X+Y)^2)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == (input_buffer[i] + input_buffer[j]) * 
-	  (input_buffer[i] + input_buffer[j])) return 1.0;
+      if (test_output == (ctx->input_buffer[i] + ctx->input_buffer[j]) * 
+          (ctx->input_buffer[i] + ctx->input_buffer[j])) return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AC() const //(X%Y)
+double cTaskLib::Task_Math2in_AC(cTaskContext* ctx) const //(X%Y)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (input_buffer[j] == 0) continue; // mod by zero
-      if (test_output == input_buffer[i] % input_buffer[j]) return 1.0;
+      if (ctx->input_buffer[j] == 0) continue; // mod by zero
+      if (test_output == ctx->input_buffer[i] % ctx->input_buffer[j]) return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AD() const //(3X/2+5Y/4)
+double cTaskLib::Task_Math2in_AD(cTaskContext* ctx) const //(3X/2+5Y/4)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == 3 * input_buffer[i] / 2 + 5 * input_buffer[j] / 4)
-	return 1.0;
+      if (test_output == 3 * ctx->input_buffer[i] / 2 + 5 * ctx->input_buffer[j] / 4)
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AE() const //(abs(X-5)+abs(Y-6))
+double cTaskLib::Task_Math2in_AE(cTaskContext* ctx) const //(abs(X-5)+abs(Y-6))
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == abs(input_buffer[i] - 5) + abs(input_buffer[j] - 6))
-	return 1.0;
+      if (test_output == abs(ctx->input_buffer[i] - 5) + abs(ctx->input_buffer[j] - 6))
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AF() const //(XY-X/Y)
+double cTaskLib::Task_Math2in_AF(cTaskContext* ctx) const //(XY-X/Y)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (input_buffer[j] == 0) continue;
-      if (0-INT_MAX > input_buffer[i] && input_buffer[j] == -1) continue;
-      if (test_output == input_buffer[i] * input_buffer[j] - 
-	  input_buffer[i] / input_buffer[j]) return 1.0;
+      if (ctx->input_buffer[j] == 0) continue;
+      if (0-INT_MAX > ctx->input_buffer[i] && ctx->input_buffer[j] == -1) continue;
+      if (test_output == ctx->input_buffer[i] * ctx->input_buffer[j] - 
+          ctx->input_buffer[i] / ctx->input_buffer[j]) return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AG() const //((X-Y)^2)
+double cTaskLib::Task_Math2in_AG(cTaskContext* ctx) const //((X-Y)^2)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == (input_buffer[i] - input_buffer[j]) *
-	  (input_buffer[i] - input_buffer[j])) return 1.0;
+      if (test_output == (ctx->input_buffer[i] - ctx->input_buffer[j]) *
+          (ctx->input_buffer[i] - ctx->input_buffer[j])) return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AH() const //(X^2+Y^2)
+double cTaskLib::Task_Math2in_AH(cTaskContext* ctx) const //(X^2+Y^2)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == input_buffer[i] * input_buffer[i] +
-	  input_buffer[j] * input_buffer[j]) return 1.0;
+      if (test_output == ctx->input_buffer[i] * ctx->input_buffer[i] +
+          ctx->input_buffer[j] * ctx->input_buffer[j]) return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AI() const //(X^2+Y^3)
+double cTaskLib::Task_Math2in_AI(cTaskContext* ctx) const //(X^2+Y^3)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == input_buffer[i] * input_buffer[i] + input_buffer[j] * input_buffer[j] * input_buffer[j]) 
-	return 1.0;
+      if (test_output == ctx->input_buffer[i] * ctx->input_buffer[i] + ctx->input_buffer[j] * ctx->input_buffer[j] * ctx->input_buffer[j]) 
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AJ() const //((sqrt(X)+Y)/(X-7))
+double cTaskLib::Task_Math2in_AJ(cTaskContext* ctx) const //((sqrt(X)+Y)/(X-7))
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (input_buffer[i] - 7 == 0) continue;
-      if (test_output == ((int) sqrt((double) abs(input_buffer[i])) + input_buffer[j]) / (input_buffer[i] - 7)) return 1.0;
+      if (ctx->input_buffer[i] - 7 == 0) continue;
+      if (test_output == ((int) sqrt((double) abs(ctx->input_buffer[i])) + ctx->input_buffer[j]) / (ctx->input_buffer[i] - 7)) return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AK() const //(log(|X/Y|))
+double cTaskLib::Task_Math2in_AK(cTaskContext* ctx) const //(log(|X/Y|))
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
-      if (i == j || input_buffer[j] == 0 ) continue;
-      if (0-INT_MAX > input_buffer[i] && input_buffer[j] == -1) continue;
-      if (input_buffer[i] / input_buffer[j] == 0) continue;
-      if (test_output == (int) log((double) abs(input_buffer[i] / input_buffer[j])))
-	return 1.0;
+      if (i == j || ctx->input_buffer[j] == 0 ) continue;
+      if (0-INT_MAX > ctx->input_buffer[i] && ctx->input_buffer[j] == -1) continue;
+      if (ctx->input_buffer[i] / ctx->input_buffer[j] == 0) continue;
+      if (test_output == (int) log((double) abs(ctx->input_buffer[i] / ctx->input_buffer[j])))
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AL() const //(log(|X|)/Y)
+double cTaskLib::Task_Math2in_AL(cTaskContext* ctx) const //(log(|X|)/Y)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
-      if (i == j || input_buffer[j] == 0) continue;
-      if (test_output == (int) log((double) abs(input_buffer[i])) / input_buffer[j])
-	return 1.0;
+      if (i == j || ctx->input_buffer[j] == 0) continue;
+      if (test_output == (int) log((double) abs(ctx->input_buffer[i])) / ctx->input_buffer[j])
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AM() const //(X/log(|Y|))
+double cTaskLib::Task_Math2in_AM(cTaskContext* ctx) const //(X/log(|Y|))
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
-      if (i == j || log((double) abs(input_buffer[j])) == 0) continue;
-      if (0-INT_MAX > input_buffer[i] && log((double) abs(input_buffer[j])) == -1) continue;
-      if (test_output == input_buffer[i] / (int) log((double) abs(input_buffer[j])))
-	return 1.0;
+      if (i == j || log((double) abs(ctx->input_buffer[j])) == 0) continue;
+      if (0-INT_MAX > ctx->input_buffer[i] && log((double) abs(ctx->input_buffer[j])) == -1) continue;
+      if (test_output == ctx->input_buffer[i] / (int) log((double) abs(ctx->input_buffer[j])))
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AN() const //(X+Y)
+double cTaskLib::Task_Math2in_AN(cTaskContext* ctx) const //(X+Y)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == input_buffer[i] + input_buffer[j])
-	return 1.0;
+      if (test_output == ctx->input_buffer[i] + ctx->input_buffer[j])
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AO() const //(X-Y)
+double cTaskLib::Task_Math2in_AO(cTaskContext* ctx) const //(X-Y)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == input_buffer[i] - input_buffer[j])
-	return 1.0;
+      if (test_output == ctx->input_buffer[i] - ctx->input_buffer[j])
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AP() const //(X/Y)
+double cTaskLib::Task_Math2in_AP(cTaskContext* ctx) const //(X/Y)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
-      if (i == j || input_buffer[j] == 0) continue;
-      if (0 - INT_MAX > input_buffer[i] && input_buffer[j] == -1) continue;
-      if (test_output == input_buffer[i] / input_buffer[j])
-	return 1.0;
+      if (i == j || ctx->input_buffer[j] == 0) continue;
+      if (0 - INT_MAX > ctx->input_buffer[i] && ctx->input_buffer[j] == -1) continue;
+      if (test_output == ctx->input_buffer[i] / ctx->input_buffer[j])
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AQ() const //(XY)
+double cTaskLib::Task_Math2in_AQ(cTaskContext* ctx) const //(XY)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == input_buffer[i] * input_buffer[j])
-	return 1.0;
+      if (test_output == ctx->input_buffer[i] * ctx->input_buffer[j])
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AR() const //(sqrt(X)+sqrt(Y))
+double cTaskLib::Task_Math2in_AR(cTaskContext* ctx) const //(sqrt(X)+sqrt(Y))
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == (int) sqrt((double) abs(input_buffer[i])) + (int) sqrt((double) abs(input_buffer[j])))
-	return 1.0;
+      if (test_output == (int) sqrt((double) abs(ctx->input_buffer[i])) + (int) sqrt((double) abs(ctx->input_buffer[j])))
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AS() const //(X+2Y)
+double cTaskLib::Task_Math2in_AS(cTaskContext* ctx) const //(X+2Y)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == input_buffer[i] + 2 * input_buffer[j])
-	return 1.0;
+      if (test_output == ctx->input_buffer[i] + 2 * ctx->input_buffer[j])
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AT() const //(X+3Y)
+double cTaskLib::Task_Math2in_AT(cTaskContext* ctx) const //(X+3Y)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == input_buffer[i] + 3 * input_buffer[j])
-	return 1.0;
+      if (test_output == ctx->input_buffer[i] + 3 * ctx->input_buffer[j])
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AU() const //(2X+3Y)
+double cTaskLib::Task_Math2in_AU(cTaskContext* ctx) const //(2X+3Y)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == 2 * input_buffer[i] + 3 * input_buffer[j])
-	return 1.0;
+      if (test_output == 2 * ctx->input_buffer[i] + 3 * ctx->input_buffer[j])
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math2in_AV() const //(XY^2)
+double cTaskLib::Task_Math2in_AV(cTaskContext* ctx) const //(XY^2)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i++) {
     for (int j = 0; j < input_size; j++) {
       if (i == j) continue;
-      if (test_output == input_buffer[i] * input_buffer[j] * input_buffer[j])
-	return 1.0;
+      if (test_output == ctx->input_buffer[i] * ctx->input_buffer[j] * ctx->input_buffer[j])
+        return 1.0;
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AA() const //(X^2+Y^2+Z^2)
+double cTaskLib::Task_Math3in_AA(cTaskContext* ctx) const //(X^2+Y^2+Z^2)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
-	if (i == j || j == k || i == k) continue;
-	if (test_output == input_buffer[i] * input_buffer[i] + 
-	    input_buffer[j] * input_buffer[j] + 
-	    input_buffer[k] * input_buffer[k]) return 1.0;
+        if (i == j || j == k || i == k) continue;
+        if (test_output == ctx->input_buffer[i] * ctx->input_buffer[i] + 
+            ctx->input_buffer[j] * ctx->input_buffer[j] + 
+            ctx->input_buffer[k] * ctx->input_buffer[k]) return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AB() const //(sqrt(X)+sqrt(Y)+sqrt(Z))
+double cTaskLib::Task_Math3in_AB(cTaskContext* ctx) const //(sqrt(X)+sqrt(Y)+sqrt(Z))
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
-	if (i == j || j == k || i == k) continue;
-	if (test_output == (int) sqrt((double) abs(input_buffer[i])) +
-	    (int) sqrt((double) abs(input_buffer[j])) + (int) sqrt((double) abs(input_buffer[k])))
-	  return 1.0;
+        if (i == j || j == k || i == k) continue;
+        if (test_output == (int) sqrt((double) abs(ctx->input_buffer[i])) +
+            (int) sqrt((double) abs(ctx->input_buffer[j])) + (int) sqrt((double) abs(ctx->input_buffer[k])))
+          return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AC() const //(X+2Y+3Z)
+double cTaskLib::Task_Math3in_AC(cTaskContext* ctx) const //(X+2Y+3Z)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
-	if (i == j || j == k || i == k) continue;
-	if (test_output == input_buffer[i] + 2 * input_buffer[j] +
-	    3 * input_buffer[k]) return 1.0;
+        if (i == j || j == k || i == k) continue;
+        if (test_output == ctx->input_buffer[i] + 2 * ctx->input_buffer[j] +
+            3 * ctx->input_buffer[k]) return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AD() const //(XY^2+Z^3)
+double cTaskLib::Task_Math3in_AD(cTaskContext* ctx) const //(XY^2+Z^3)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
-	if (i == j || j == k || i == k) continue;
-	if (test_output == input_buffer[i] * input_buffer[j] * input_buffer[j] + input_buffer[k] * input_buffer[k] * input_buffer[k])
-	  return 1.0;
+        if (i == j || j == k || i == k) continue;
+        if (test_output == ctx->input_buffer[i] * ctx->input_buffer[j] * ctx->input_buffer[j] + ctx->input_buffer[k] * ctx->input_buffer[k] * ctx->input_buffer[k])
+          return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AE() const //((X%Y)*Z)
+double cTaskLib::Task_Math3in_AE(cTaskContext* ctx) const //((X%Y)*Z)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
-	if (i == j || j == k || i == k) continue;
-	if (input_buffer[j] == 0) continue; // mod by zero
-	if (test_output == input_buffer[i] % input_buffer[j] * input_buffer[k])
-	  return 1.0;
+        if (i == j || j == k || i == k) continue;
+        if (ctx->input_buffer[j] == 0) continue; // mod by zero
+        if (test_output == ctx->input_buffer[i] % ctx->input_buffer[j] * ctx->input_buffer[k])
+          return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AF() const //((X+Y)^2+sqrt(Y+Z))
+double cTaskLib::Task_Math3in_AF(cTaskContext* ctx) const //((X+Y)^2+sqrt(Y+Z))
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
-	if (i == j || j == k || i == k) continue;
-	if (test_output == (input_buffer[i] + input_buffer[j]) *
-	    (input_buffer[i] + input_buffer[j]) +
-	    (int) sqrt((double) abs(input_buffer[j] + input_buffer[k])))
-	  return 1.0;
+        if (i == j || j == k || i == k) continue;
+        if (test_output == (ctx->input_buffer[i] + ctx->input_buffer[j]) *
+            (ctx->input_buffer[i] + ctx->input_buffer[j]) +
+            (int) sqrt((double) abs(ctx->input_buffer[j] + ctx->input_buffer[k])))
+          return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AG() const //((XY)%(YZ))
+double cTaskLib::Task_Math3in_AG(cTaskContext* ctx) const //((XY)%(YZ))
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
-	if (i == j || j == k || i == k) continue;
-	int mod_base = input_buffer[j] * input_buffer[k];
-	if (mod_base == 0) continue;
-	if (test_output == (input_buffer[i] * input_buffer[j]) %
-	    mod_base) return 1.0;
+        if (i == j || j == k || i == k) continue;
+        int mod_base = ctx->input_buffer[j] * ctx->input_buffer[k];
+        if (mod_base == 0) continue;
+        if (test_output == (ctx->input_buffer[i] * ctx->input_buffer[j]) %
+            mod_base) return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AH() const //(X+Y+Z)
+double cTaskLib::Task_Math3in_AH(cTaskContext* ctx) const //(X+Y+Z)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
-	if (i == j || j == k || i == k) continue;
-	if (test_output == input_buffer[i] + input_buffer[j] + input_buffer[k])
-	  return 1.0;
+        if (i == j || j == k || i == k) continue;
+        if (test_output == ctx->input_buffer[i] + ctx->input_buffer[j] + ctx->input_buffer[k])
+          return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AI() const //(-X-Y-Z)
+double cTaskLib::Task_Math3in_AI(cTaskContext* ctx) const //(-X-Y-Z)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
-	if (i == j || j == k || i == k) continue;
-	if (test_output == 0 - input_buffer[i] - input_buffer[j] - input_buffer[k])
-	  return 1.0;
+        if (i == j || j == k || i == k) continue;
+        if (test_output == 0 - ctx->input_buffer[i] - ctx->input_buffer[j] - ctx->input_buffer[k])
+          return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AJ() const //((X-Y)^2+(Y-Z)^2+(Z-X)^2)
+double cTaskLib::Task_Math3in_AJ(cTaskContext* ctx) const //((X-Y)^2+(Y-Z)^2+(Z-X)^2)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
-	if (i == j || j == k || i == k) continue;
-	if (test_output == (input_buffer[i] - input_buffer[j]) * (input_buffer[i] - input_buffer[j]) + (input_buffer[j] - input_buffer[k]) * (input_buffer[j] - input_buffer[k]) + (input_buffer[k] - input_buffer[i]) * (input_buffer[k] - input_buffer[i]))
-	  return 1.0;
+        if (i == j || j == k || i == k) continue;
+        if (test_output == (ctx->input_buffer[i] - ctx->input_buffer[j]) * (ctx->input_buffer[i] - ctx->input_buffer[j]) + (ctx->input_buffer[j] - ctx->input_buffer[k]) * (ctx->input_buffer[j] - ctx->input_buffer[k]) + (ctx->input_buffer[k] - ctx->input_buffer[i]) * (ctx->input_buffer[k] - ctx->input_buffer[i]))
+          return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AK() const //((X+Y)^2+(Y+Z)^2+(Z+X)^2)
+double cTaskLib::Task_Math3in_AK(cTaskContext* ctx) const //((X+Y)^2+(Y+Z)^2+(Z+X)^2)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
-	if (i == j || j == k || i == k) continue;
-	if (test_output == (input_buffer[i] + input_buffer[j]) * (input_buffer[i] + input_buffer[j]) + (input_buffer[j] + input_buffer[k]) * (input_buffer[j] + input_buffer[k]) + (input_buffer[k] + input_buffer[i]) * (input_buffer[k] + input_buffer[i])) 
-	  return 1.0;
+        if (i == j || j == k || i == k) continue;
+        if (test_output == (ctx->input_buffer[i] + ctx->input_buffer[j]) * (ctx->input_buffer[i] + ctx->input_buffer[j]) + (ctx->input_buffer[j] + ctx->input_buffer[k]) * (ctx->input_buffer[j] + ctx->input_buffer[k]) + (ctx->input_buffer[k] + ctx->input_buffer[i]) * (ctx->input_buffer[k] + ctx->input_buffer[i])) 
+          return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AL() const //((X-Y)^2+(X-Z)^2)
+double cTaskLib::Task_Math3in_AL(cTaskContext* ctx) const //((X-Y)^2+(X-Z)^2)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
-	if (i == j || j == k || i == k) continue;  
-	if (test_output == (input_buffer[i] - input_buffer[j]) * (input_buffer[i] - input_buffer[j]) + (input_buffer[i] - input_buffer[k]) * (input_buffer[i] - input_buffer[k]))
-	  return 1.0;
+        if (i == j || j == k || i == k) continue;  
+        if (test_output == (ctx->input_buffer[i] - ctx->input_buffer[j]) * (ctx->input_buffer[i] - ctx->input_buffer[j]) + (ctx->input_buffer[i] - ctx->input_buffer[k]) * (ctx->input_buffer[i] - ctx->input_buffer[k]))
+          return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_Math3in_AM() const //((X+Y)^2+(Y+Z)^2)
+double cTaskLib::Task_Math3in_AM(cTaskContext* ctx) const //((X+Y)^2+(Y+Z)^2)
 {
-  const int test_output = output_buffer[0];
-  const int input_size = input_buffer.GetNumStored();
+  const int test_output = ctx->output_buffer[0];
+  const int input_size = ctx->input_buffer.GetNumStored();
   for (int i = 0; i < input_size; i ++) {
     for (int j = 0; j < input_size; j ++) {
       for (int k = 0; k < input_size; k ++) {
-	if (i == j || j == k || i == k) continue;  
-	if (test_output == (input_buffer[i] + input_buffer[j]) * (input_buffer[i] + input_buffer[j]) + (input_buffer[i] + input_buffer[k]) * (input_buffer[i] + input_buffer[k]))
-	  return 1.0;
+        if (i == j || j == k || i == k) continue;  
+        if (test_output == (ctx->input_buffer[i] + ctx->input_buffer[j]) * (ctx->input_buffer[i] + ctx->input_buffer[j]) + (ctx->input_buffer[i] + ctx->input_buffer[k]) * (ctx->input_buffer[i] + ctx->input_buffer[k]))
+          return 1.0;
       }
     }
   }
   return 0.0;
 }
 
-double cTaskLib::Task_CommEcho() const
+double cTaskLib::Task_CommEcho(cTaskContext* ctx) const
 {
-  const int test_output = output_buffer[0];
-
-  tListIterator<tBuffer<int> > buff_it(other_input_buffers);  
-
+  const int test_output = ctx->output_buffer[0];
+  
+  tListIterator<tBuffer<int> > buff_it(ctx->other_input_buffers);  
+  
   while (buff_it.Next() != NULL) {
     tBuffer<int> & cur_buff = *(buff_it.Get());
     const int buff_size = cur_buff.GetNumStored();
@@ -1684,16 +1737,16 @@
       if (test_output == cur_buff[i]) return 1.0;
     }
   }
-
+  
   return 0.0;
 }
 
-double cTaskLib::Task_CommNot() const
+double cTaskLib::Task_CommNot(cTaskContext* ctx) const
 {
-  const int test_output = output_buffer[0];
-
-  tListIterator<tBuffer<int> > buff_it(other_input_buffers);  
-
+  const int test_output = ctx->output_buffer[0];
+  
+  tListIterator<tBuffer<int> > buff_it(ctx->other_input_buffers);  
+  
   while (buff_it.Next() != NULL) {
     tBuffer<int> & cur_buff = *(buff_it.Get());
     const int buff_size = cur_buff.GetNumStored();
@@ -1701,6 +1754,6 @@
       if (test_output == (0-(cur_buff[i]+1))) return 1.0;
     }
   }
-
+  
   return 0.0;
 }

Modified: development/source/main/cTaskLib.h
===================================================================
--- development/source/main/cTaskLib.h	2006-03-09 21:48:04 UTC (rev 499)
+++ development/source/main/cTaskLib.h	2006-03-10 03:55:47 UTC (rev 500)
@@ -11,6 +11,9 @@
 #ifndef cTaskLib_h
 #define cTaskLib_h
 
+#ifndef cTaskEntry_h
+#include "cTaskEntry.h"
+#endif
 #ifndef tArray_h
 #include "tArray.h"
 #endif
@@ -21,12 +24,31 @@
 #include "tList.h"
 #endif
 
-class cTaskLib;
-typedef double (cTaskLib::*tTaskTest)() const;
 
 class cString;
-class cTaskEntry;
 
+class cTaskContext
+{
+public:
+  tBuffer<int> input_buffer;
+  tBuffer<int> output_buffer;
+  tList<tBuffer<int> > other_input_buffers;
+  tList<tBuffer<int> > other_output_buffers;
+  int logic_id;
+  
+  cTaskContext(const tBuffer<int>& inputs, const tBuffer<int>& outputs,
+               const tList<tBuffer<int> >& other_inputs,
+               const tList<tBuffer<int> >& other_outputs, int in_logic_id)
+  : input_buffer(3), output_buffer(3), logic_id(in_logic_id)
+  {
+    input_buffer = inputs;
+    output_buffer = outputs;
+    other_input_buffers.Copy(other_inputs);
+    other_output_buffers.Copy(other_outputs);
+  }
+};
+
+
 class cTaskLib
 {
 private:
@@ -38,11 +60,6 @@
   bool use_neighbor_output;
 
   // Active task information...
-  mutable tBuffer<int> input_buffer;
-  mutable tBuffer<int> output_buffer;
-  mutable tList<tBuffer<int> > other_input_buffers;
-  mutable tList<tBuffer<int> > other_output_buffers;
-  mutable int logic_id;
 
   enum req_list
   {
@@ -65,164 +82,174 @@
   cTaskEntry* AddTask(const cString& name);
   const cTaskEntry& GetTask(int id) const;
   
-  void SetupTests(const tBuffer<int>& inputs, const tBuffer<int>& outputs,
-                  const tList<tBuffer<int> >& other_inputs,
-                  const tList<tBuffer<int> >& other_outputs) const;
-  double TestOutput(const cTaskEntry& task) const;
+  cTaskContext* SetupTests(const tBuffer<int>& inputs, const tBuffer<int>& outputs,
+                          const tList<tBuffer<int> >& other_inputs,
+                          const tList<tBuffer<int> >& other_outputs) const
+  {
+    return new cTaskContext(inputs, outputs, other_inputs, other_outputs, SetupLogicTests(inputs, outputs));
+  }
+  inline double TestOutput(const cTaskEntry& task, cTaskContext* ctx) const;
 
   bool UseNeighborInput() const { return use_neighbor_input; }
   bool UseNeighborOutput() const { return use_neighbor_output; }
-
+  
 private:  // Direct task related methods
   void NewTask(const cString& name, const cString& desc, tTaskTest task_fun, int reqs = 0);
-  void SetupLogicTests(const tBuffer<int>& inputs, const tBuffer<int>& outputs) const;
+  int SetupLogicTests(const tBuffer<int>& inputs, const tBuffer<int>& outputs) const;
 
   inline double FractionalReward(unsigned int supplied, unsigned int correct);  
 
-  double Task_Echo() const;
-  double Task_Add() const;
-  double Task_Sub() const;
+  double Task_Echo(cTaskContext* ctx) const;
+  double Task_Add(cTaskContext* ctx) const;
+  double Task_Sub(cTaskContext* ctx) const;
 
   // 1- and 2-Input Logic Tasks
-  double Task_Not() const;
-  double Task_Nand() const;
-  double Task_And() const;
-  double Task_OrNot() const;
-  double Task_Or() const;
-  double Task_AndNot() const;
-  double Task_Nor() const;
-  double Task_Xor() const;
-  double Task_Equ() const;
+  double Task_Not(cTaskContext* ctx) const;
+  double Task_Nand(cTaskContext* ctx) const;
+  double Task_And(cTaskContext* ctx) const;
+  double Task_OrNot(cTaskContext* ctx) const;
+  double Task_Or(cTaskContext* ctx) const;
+  double Task_AndNot(cTaskContext* ctx) const;
+  double Task_Nor(cTaskContext* ctx) const;
+  double Task_Xor(cTaskContext* ctx) const;
+  double Task_Equ(cTaskContext* ctx) const;
 
   // 3-Input Logic Tasks
-  double Task_Logic3in_AA() const;
-  double Task_Logic3in_AB() const;
-  double Task_Logic3in_AC() const;
-  double Task_Logic3in_AD() const;
-  double Task_Logic3in_AE() const;
-  double Task_Logic3in_AF() const;
-  double Task_Logic3in_AG() const;
-  double Task_Logic3in_AH() const;
-  double Task_Logic3in_AI() const;
-  double Task_Logic3in_AJ() const;
-  double Task_Logic3in_AK() const;
-  double Task_Logic3in_AL() const;
-  double Task_Logic3in_AM() const;
-  double Task_Logic3in_AN() const;
-  double Task_Logic3in_AO() const;
-  double Task_Logic3in_AP() const;
-  double Task_Logic3in_AQ() const;
-  double Task_Logic3in_AR() const;
-  double Task_Logic3in_AS() const;
-  double Task_Logic3in_AT() const;
-  double Task_Logic3in_AU() const;
-  double Task_Logic3in_AV() const;
-  double Task_Logic3in_AW() const;
-  double Task_Logic3in_AX() const;
-  double Task_Logic3in_AY() const;
-  double Task_Logic3in_AZ() const;
-  double Task_Logic3in_BA() const;
-  double Task_Logic3in_BB() const;
-  double Task_Logic3in_BC() const;
-  double Task_Logic3in_BD() const;
-  double Task_Logic3in_BE() const;
-  double Task_Logic3in_BF() const;
-  double Task_Logic3in_BG() const;
-  double Task_Logic3in_BH() const;
-  double Task_Logic3in_BI() const;
-  double Task_Logic3in_BJ() const;
-  double Task_Logic3in_BK() const;
-  double Task_Logic3in_BL() const;
-  double Task_Logic3in_BM() const;
-  double Task_Logic3in_BN() const;
-  double Task_Logic3in_BO() const;
-  double Task_Logic3in_BP() const;
-  double Task_Logic3in_BQ() const;
-  double Task_Logic3in_BR() const;
-  double Task_Logic3in_BS() const;
-  double Task_Logic3in_BT() const;
-  double Task_Logic3in_BU() const;
-  double Task_Logic3in_BV() const;
-  double Task_Logic3in_BW() const;
-  double Task_Logic3in_BX() const;
-  double Task_Logic3in_BY() const;
-  double Task_Logic3in_BZ() const;
-  double Task_Logic3in_CA() const;
-  double Task_Logic3in_CB() const;
-  double Task_Logic3in_CC() const;
-  double Task_Logic3in_CD() const;
-  double Task_Logic3in_CE() const;
-  double Task_Logic3in_CF() const;
-  double Task_Logic3in_CG() const;
-  double Task_Logic3in_CH() const;
-  double Task_Logic3in_CI() const;
-  double Task_Logic3in_CJ() const;
-  double Task_Logic3in_CK() const;
-  double Task_Logic3in_CL() const;
-  double Task_Logic3in_CM() const;
-  double Task_Logic3in_CN() const;
-  double Task_Logic3in_CO() const;
-  double Task_Logic3in_CP() const;
+  double Task_Logic3in_AA(cTaskContext* ctx) const;
+  double Task_Logic3in_AB(cTaskContext* ctx) const;
+  double Task_Logic3in_AC(cTaskContext* ctx) const;
+  double Task_Logic3in_AD(cTaskContext* ctx) const;
+  double Task_Logic3in_AE(cTaskContext* ctx) const;
+  double Task_Logic3in_AF(cTaskContext* ctx) const;
+  double Task_Logic3in_AG(cTaskContext* ctx) const;
+  double Task_Logic3in_AH(cTaskContext* ctx) const;
+  double Task_Logic3in_AI(cTaskContext* ctx) const;
+  double Task_Logic3in_AJ(cTaskContext* ctx) const;
+  double Task_Logic3in_AK(cTaskContext* ctx) const;
+  double Task_Logic3in_AL(cTaskContext* ctx) const;
+  double Task_Logic3in_AM(cTaskContext* ctx) const;
+  double Task_Logic3in_AN(cTaskContext* ctx) const;
+  double Task_Logic3in_AO(cTaskContext* ctx) const;
+  double Task_Logic3in_AP(cTaskContext* ctx) const;
+  double Task_Logic3in_AQ(cTaskContext* ctx) const;
+  double Task_Logic3in_AR(cTaskContext* ctx) const;
+  double Task_Logic3in_AS(cTaskContext* ctx) const;
+  double Task_Logic3in_AT(cTaskContext* ctx) const;
+  double Task_Logic3in_AU(cTaskContext* ctx) const;
+  double Task_Logic3in_AV(cTaskContext* ctx) const;
+  double Task_Logic3in_AW(cTaskContext* ctx) const;
+  double Task_Logic3in_AX(cTaskContext* ctx) const;
+  double Task_Logic3in_AY(cTaskContext* ctx) const;
+  double Task_Logic3in_AZ(cTaskContext* ctx) const;
+  double Task_Logic3in_BA(cTaskContext* ctx) const;
+  double Task_Logic3in_BB(cTaskContext* ctx) const;
+  double Task_Logic3in_BC(cTaskContext* ctx) const;
+  double Task_Logic3in_BD(cTaskContext* ctx) const;
+  double Task_Logic3in_BE(cTaskContext* ctx) const;
+  double Task_Logic3in_BF(cTaskContext* ctx) const;
+  double Task_Logic3in_BG(cTaskContext* ctx) const;
+  double Task_Logic3in_BH(cTaskContext* ctx) const;
+  double Task_Logic3in_BI(cTaskContext* ctx) const;
+  double Task_Logic3in_BJ(cTaskContext* ctx) const;
+  double Task_Logic3in_BK(cTaskContext* ctx) const;
+  double Task_Logic3in_BL(cTaskContext* ctx) const;
+  double Task_Logic3in_BM(cTaskContext* ctx) const;
+  double Task_Logic3in_BN(cTaskContext* ctx) const;
+  double Task_Logic3in_BO(cTaskContext* ctx) const;
+  double Task_Logic3in_BP(cTaskContext* ctx) const;
+  double Task_Logic3in_BQ(cTaskContext* ctx) const;
+  double Task_Logic3in_BR(cTaskContext* ctx) const;
+  double Task_Logic3in_BS(cTaskContext* ctx) const;
+  double Task_Logic3in_BT(cTaskContext* ctx) const;
+  double Task_Logic3in_BU(cTaskContext* ctx) const;
+  double Task_Logic3in_BV(cTaskContext* ctx) const;
+  double Task_Logic3in_BW(cTaskContext* ctx) const;
+  double Task_Logic3in_BX(cTaskContext* ctx) const;
+  double Task_Logic3in_BY(cTaskContext* ctx) const;
+  double Task_Logic3in_BZ(cTaskContext* ctx) const;
+  double Task_Logic3in_CA(cTaskContext* ctx) const;
+  double Task_Logic3in_CB(cTaskContext* ctx) const;
+  double Task_Logic3in_CC(cTaskContext* ctx) const;
+  double Task_Logic3in_CD(cTaskContext* ctx) const;
+  double Task_Logic3in_CE(cTaskContext* ctx) const;
+  double Task_Logic3in_CF(cTaskContext* ctx) const;
+  double Task_Logic3in_CG(cTaskContext* ctx) const;
+  double Task_Logic3in_CH(cTaskContext* ctx) const;
+  double Task_Logic3in_CI(cTaskContext* ctx) const;
+  double Task_Logic3in_CJ(cTaskContext* ctx) const;
+  double Task_Logic3in_CK(cTaskContext* ctx) const;
+  double Task_Logic3in_CL(cTaskContext* ctx) const;
+  double Task_Logic3in_CM(cTaskContext* ctx) const;
+  double Task_Logic3in_CN(cTaskContext* ctx) const;
+  double Task_Logic3in_CO(cTaskContext* ctx) const;
+  double Task_Logic3in_CP(cTaskContext* ctx) const;
 
   // 1-Input math tasks...
-  double Task_Math1in_AA() const;
-  double Task_Math1in_AB() const;
-  double Task_Math1in_AC() const;
-  double Task_Math1in_AD() const;
-  double Task_Math1in_AE() const;
-  double Task_Math1in_AF() const;
-  double Task_Math1in_AG() const;
-  double Task_Math1in_AH() const;
-  double Task_Math1in_AI() const;
-  double Task_Math1in_AJ() const;
-  double Task_Math1in_AK() const;
-  double Task_Math1in_AL() const;
-  double Task_Math1in_AM() const;
-  double Task_Math1in_AN() const;
-  double Task_Math1in_AO() const;
-  double Task_Math1in_AP() const;
+  double Task_Math1in_AA(cTaskContext* ctx) const;
+  double Task_Math1in_AB(cTaskContext* ctx) const;
+  double Task_Math1in_AC(cTaskContext* ctx) const;
+  double Task_Math1in_AD(cTaskContext* ctx) const;
+  double Task_Math1in_AE(cTaskContext* ctx) const;
+  double Task_Math1in_AF(cTaskContext* ctx) const;
+  double Task_Math1in_AG(cTaskContext* ctx) const;
+  double Task_Math1in_AH(cTaskContext* ctx) const;
+  double Task_Math1in_AI(cTaskContext* ctx) const;
+  double Task_Math1in_AJ(cTaskContext* ctx) const;
+  double Task_Math1in_AK(cTaskContext* ctx) const;
+  double Task_Math1in_AL(cTaskContext* ctx) const;
+  double Task_Math1in_AM(cTaskContext* ctx) const;
+  double Task_Math1in_AN(cTaskContext* ctx) const;
+  double Task_Math1in_AO(cTaskContext* ctx) const;
+  double Task_Math1in_AP(cTaskContext* ctx) const;
 
   // 2-Input math tasks...
-  double Task_Math2in_AA() const;
-  double Task_Math2in_AB() const;
-  double Task_Math2in_AC() const;
-  double Task_Math2in_AD() const;
-  double Task_Math2in_AE() const;
-  double Task_Math2in_AF() const;
-  double Task_Math2in_AG() const;
-  double Task_Math2in_AH() const;
-  double Task_Math2in_AI() const;
-  double Task_Math2in_AJ() const;
-  double Task_Math2in_AK() const;
-  double Task_Math2in_AL() const;
-  double Task_Math2in_AM() const;
-  double Task_Math2in_AN() const;
-  double Task_Math2in_AO() const;
-  double Task_Math2in_AP() const;
-  double Task_Math2in_AQ() const;
-  double Task_Math2in_AR() const;
-  double Task_Math2in_AS() const;
-  double Task_Math2in_AT() const;
-  double Task_Math2in_AU() const;
-  double Task_Math2in_AV() const;
+  double Task_Math2in_AA(cTaskContext* ctx) const;
+  double Task_Math2in_AB(cTaskContext* ctx) const;
+  double Task_Math2in_AC(cTaskContext* ctx) const;
+  double Task_Math2in_AD(cTaskContext* ctx) const;
+  double Task_Math2in_AE(cTaskContext* ctx) const;
+  double Task_Math2in_AF(cTaskContext* ctx) const;
+  double Task_Math2in_AG(cTaskContext* ctx) const;
+  double Task_Math2in_AH(cTaskContext* ctx) const;
+  double Task_Math2in_AI(cTaskContext* ctx) const;
+  double Task_Math2in_AJ(cTaskContext* ctx) const;
+  double Task_Math2in_AK(cTaskContext* ctx) const;
+  double Task_Math2in_AL(cTaskContext* ctx) const;
+  double Task_Math2in_AM(cTaskContext* ctx) const;
+  double Task_Math2in_AN(cTaskContext* ctx) const;
+  double Task_Math2in_AO(cTaskContext* ctx) const;
+  double Task_Math2in_AP(cTaskContext* ctx) const;
+  double Task_Math2in_AQ(cTaskContext* ctx) const;
+  double Task_Math2in_AR(cTaskContext* ctx) const;
+  double Task_Math2in_AS(cTaskContext* ctx) const;
+  double Task_Math2in_AT(cTaskContext* ctx) const;
+  double Task_Math2in_AU(cTaskContext* ctx) const;
+  double Task_Math2in_AV(cTaskContext* ctx) const;
 
-  double Task_Math3in_AA() const;
-  double Task_Math3in_AB() const;
-  double Task_Math3in_AC() const;
-  double Task_Math3in_AD() const;
-  double Task_Math3in_AE() const;
-  double Task_Math3in_AF() const;
-  double Task_Math3in_AG() const;
-  double Task_Math3in_AH() const;
-  double Task_Math3in_AI() const;
-  double Task_Math3in_AJ() const;
-  double Task_Math3in_AK() const;
-  double Task_Math3in_AL() const;
-  double Task_Math3in_AM() const;
+  double Task_Math3in_AA(cTaskContext* ctx) const;
+  double Task_Math3in_AB(cTaskContext* ctx) const;
+  double Task_Math3in_AC(cTaskContext* ctx) const;
+  double Task_Math3in_AD(cTaskContext* ctx) const;
+  double Task_Math3in_AE(cTaskContext* ctx) const;
+  double Task_Math3in_AF(cTaskContext* ctx) const;
+  double Task_Math3in_AG(cTaskContext* ctx) const;
+  double Task_Math3in_AH(cTaskContext* ctx) const;
+  double Task_Math3in_AI(cTaskContext* ctx) const;
+  double Task_Math3in_AJ(cTaskContext* ctx) const;
+  double Task_Math3in_AK(cTaskContext* ctx) const;
+  double Task_Math3in_AL(cTaskContext* ctx) const;
+  double Task_Math3in_AM(cTaskContext* ctx) const;
   
   // Communication Tasks...
-  double Task_CommEcho() const;
-  double Task_CommNot() const;
+  double Task_CommEcho(cTaskContext* ctx) const;
+  double Task_CommNot(cTaskContext* ctx) const;
 };
 
+
+inline double cTaskLib::TestOutput(const cTaskEntry& task, cTaskContext* ctx) const
+{
+  tTaskTest test_fun = task.GetTestFun();
+  return (this->*test_fun)(ctx);
+}
+
 #endif




More information about the Avida-cvs mailing list