[Avida-SVN] r3060 - in branches/hjg-dev/source: cpu main
hjg at myxo.css.msu.edu
hjg at myxo.css.msu.edu
Thu Dec 18 13:34:13 PST 2008
Author: hjg
Date: 2008-12-18 16:34:13 -0500 (Thu, 18 Dec 2008)
New Revision: 3060
Modified:
branches/hjg-dev/source/cpu/cHardwareCPU.cc
branches/hjg-dev/source/main/cOrganism.h
branches/hjg-dev/source/main/cTaskLib.cc
Log:
changed reputation function to be additive
Modified: branches/hjg-dev/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/hjg-dev/source/cpu/cHardwareCPU.cc 2008-12-18 21:07:20 UTC (rev 3059)
+++ branches/hjg-dev/source/cpu/cHardwareCPU.cc 2008-12-18 21:34:13 UTC (rev 3060)
@@ -7407,6 +7407,7 @@
best = i;
}
}
+
// If the organism has the same tag as the neighbor, disable the
@@ -7419,7 +7420,14 @@
// update the reputation unless the organism is a str catter
if (!organism->GetStringCatter()){
- organism->SetAverageReputation(max);
+
+ int len = 1;
+ if (strings_to_match.size()) len = strings_to_match[0].GetSize();
+ // organism->SetAverageReputation(max);
+ int rep = (max - floor(len/2));
+ if (rep > 0) organism->AddReputation(rep);
+
+
}
// Donate the string
neighbor->ReceiveString(org_str, organism->GetID());
Modified: branches/hjg-dev/source/main/cOrganism.h
===================================================================
--- branches/hjg-dev/source/main/cOrganism.h 2008-12-18 21:07:20 UTC (rev 3059)
+++ branches/hjg-dev/source/main/cOrganism.h 2008-12-18 21:34:13 UTC (rev 3060)
@@ -464,6 +464,8 @@
void SetReputation(int rep);
// update the reputation to be an average on the basis of this new info
void SetAverageReputation(int rep);
+ // update the reputation by addint this new information
+ void AddReputation(int rep) { SetReputation(GetReputation() + rep); }
// increment reputation
void IncReputation() { SetReputation(GetReputation() + 1); }
// get number of donors
Modified: branches/hjg-dev/source/main/cTaskLib.cc
===================================================================
--- branches/hjg-dev/source/main/cTaskLib.cc 2008-12-18 21:07:20 UTC (rev 3059)
+++ branches/hjg-dev/source/main/cTaskLib.cc 2008-12-18 21:34:13 UTC (rev 3060)
@@ -2079,10 +2079,10 @@
m_world->GetStats().AddStringBitsMatchedValue(name, max_num_matched);
// if the organism hasn't donated, then zero out its reputation.
- if ((ctx.GetOrganism()->GetReputation() > 0) &&
+/* if ((ctx.GetOrganism()->GetReputation() > 0) &&
(ctx.GetOrganism()->GetNumberOfDonations() == 0)) {
ctx.GetOrganism()->SetReputation(0);
- }
+ }*/
std::pair < int, int > best_string;
int donated_string;
More information about the Avida-cvs
mailing list