[Avida-SVN] r1084 - branches/coopcomm/source/cpu

dknoester at myxo.css.msu.edu dknoester at myxo.css.msu.edu
Thu Nov 16 04:57:44 PST 2006


Author: dknoester
Date: 2006-11-16 07:57:44 -0500 (Thu, 16 Nov 2006)
New Revision: 1084

Modified:
   branches/coopcomm/source/cpu/cHardwareCPU.cc
Log:
Updating dynamic-cost send-msg to cost 0 when an organism sends it's own id.

Modified: branches/coopcomm/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/coopcomm/source/cpu/cHardwareCPU.cc	2006-11-15 19:35:46 UTC (rev 1083)
+++ branches/coopcomm/source/cpu/cHardwareCPU.cc	2006-11-16 12:57:44 UTC (rev 1084)
@@ -574,6 +574,7 @@
       // Else, set the counter.
       m_dynamicCosts[inst_idx].second = (this->*(m_costFunctions[inst_idx]))(ctx);
       m_dynamicCosts[inst_idx].first = true;
+      //m_world->GetStats().DynamicInstCost
     }
     
     // Return false if we're not done yet, reset and fall through when we're done.
@@ -3507,11 +3508,13 @@
   msg.SetData(GetRegister(data_reg));
   
   std::pair<bool,int> age = organism->CalcMessageAge(msg);
-  if(age.first) {
-    return m_world->GetStats().GetUpdate() - age.second;
-  }
-  
-  return age.second;
+  if(msg.GetData() == organism->GetRandomCellID()) {
+    return 0; // Zero-cost for sending own ID.
+  } 
+
+  // age.second returns the origination time of the message, or now.
+  // Either way, the cost is the same (now-origination).
+  return m_world->GetStats().GetUpdate() - age.second;
 }
 
 




More information about the Avida-cvs mailing list