[Avida-SVN] r2989 - in branches/hjg-dev/source: cpu main
hjg at myxo.css.msu.edu
hjg at myxo.css.msu.edu
Sun Nov 30 15:22:15 PST 2008
Author: hjg
Date: 2008-11-30 18:22:15 -0500 (Sun, 30 Nov 2008)
New Revision: 2989
Modified:
branches/hjg-dev/source/cpu/cHardwareCPU.cc
branches/hjg-dev/source/main/cAvidaConfig.h
branches/hjg-dev/source/main/cPopulation.cc
Log:
added support for offspring inheriting their parent's reputation.
Modified: branches/hjg-dev/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/hjg-dev/source/cpu/cHardwareCPU.cc 2008-11-30 04:07:49 UTC (rev 2988)
+++ branches/hjg-dev/source/cpu/cHardwareCPU.cc 2008-11-30 23:22:15 UTC (rev 2989)
@@ -3512,7 +3512,7 @@
// Put the facing back where it was.
for (int i = 0; i < neighbor_id; i++) organism->Rotate(-1);
- // Donate only if we have found a close enough relative...
+ // Donate
if (neighbor != NULL){
DoDonate(neighbor);
}
Modified: branches/hjg-dev/source/main/cAvidaConfig.h
===================================================================
--- branches/hjg-dev/source/main/cAvidaConfig.h 2008-11-30 04:07:49 UTC (rev 2988)
+++ branches/hjg-dev/source/main/cAvidaConfig.h 2008-11-30 23:22:15 UTC (rev 2989)
@@ -569,6 +569,8 @@
CONFIG_ADD_VAR(DONATION_FAILURE_PERCENT, int, 0, "Percentage of times that a donation fails");
CONFIG_ADD_VAR(RANDOMIZE_RAW_MATERIAL_AMOUNT, int, 0, "Should all the organisms receive the same amount 0/1 (off/on)");
CONFIG_ADD_VAR(INTER_SPECIES_DONATION, int, 0, "Only donations from one species to another are allowed 0/1 (off/on)");
+ CONFIG_ADD_VAR(INHERIT_REPUTATION, int, 0, "0=reputation are not inherited\n1=reputations are inherited");
+
#endif
Modified: branches/hjg-dev/source/main/cPopulation.cc
===================================================================
--- branches/hjg-dev/source/main/cPopulation.cc 2008-11-30 04:07:49 UTC (rev 2988)
+++ branches/hjg-dev/source/main/cPopulation.cc 2008-11-30 23:22:15 UTC (rev 2989)
@@ -354,6 +354,12 @@
//By default, store the parent cclade, this may get modified in ActivateOrgansim (@MRR)
child_array[i]->SetCCladeLabel(parent_organism.GetCCladeLabel());
+
+ // If inherited reputation is turned on, set the offspring's reputation
+ // to that of its parent.
+ if (m_world->GetConfig().INHERIT_REPUTATION.Get()) {
+ child_array[i]->SetReputation(parent_organism.GetReputation());
+ }
}
// If we're not about to kill the parent, do some extra work on it.
More information about the Avida-cvs
mailing list