[Avida-SVN] r2820 - branches/hjg-dev/source/cpu
hjg at myxo.css.msu.edu
hjg at myxo.css.msu.edu
Wed Oct 8 11:12:53 PDT 2008
Author: hjg
Date: 2008-10-08 14:12:53 -0400 (Wed, 08 Oct 2008)
New Revision: 2820
Modified:
branches/hjg-dev/source/cpu/cHardwareCPU.cc
Log:
better defaults for reputation checking instruction.
Modified: branches/hjg-dev/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/hjg-dev/source/cpu/cHardwareCPU.cc 2008-10-08 15:05:07 UTC (rev 2819)
+++ branches/hjg-dev/source/cpu/cHardwareCPU.cc 2008-10-08 18:12:53 UTC (rev 2820)
@@ -6682,17 +6682,20 @@
{
// Get faced neighbor
cOrganism * neighbor = organism->GetNeighbor();
+
+ // track if an organism has checked reputation
+ organism->CheckedReputation();
+ const int opinion_reg = FindModifiedRegister(REG_BX);
+ const int age_reg = FindNextRegister(opinion_reg);
+
if(neighbor != NULL && neighbor->HasOpinion()) {
- const int opinion_reg = FindModifiedRegister(REG_BX);
- const int age_reg = FindNextRegister(opinion_reg);
-
GetRegister(opinion_reg) = neighbor->GetOpinion().first;
GetRegister(age_reg) = m_world->GetStats().GetUpdate() - neighbor->GetOpinion().second;
-
- // track if an organism has checked reputation
- organism->CheckedReputation();
-
+ } else {
+ // the neighbor has not donated, thus set to 0.
+ GetRegister(opinion_reg) = 0;
+ GetRegister(age_reg) = m_world->GetStats().GetUpdate();
}
return true;
}
More information about the Avida-cvs
mailing list