[Avida-SVN] r3036 - branches/hjg-dev/source/main
hjg at myxo.css.msu.edu
hjg at myxo.css.msu.edu
Sat Dec 13 14:03:15 PST 2008
Author: hjg
Date: 2008-12-13 17:03:15 -0500 (Sat, 13 Dec 2008)
New Revision: 3036
Modified:
branches/hjg-dev/source/main/cAvidaConfig.h
branches/hjg-dev/source/main/cTaskLib.cc
Log:
added ability to reset reputation on task.
Modified: branches/hjg-dev/source/main/cAvidaConfig.h
===================================================================
--- branches/hjg-dev/source/main/cAvidaConfig.h 2008-12-13 21:47:37 UTC (rev 3035)
+++ branches/hjg-dev/source/main/cAvidaConfig.h 2008-12-13 22:03:15 UTC (rev 3036)
@@ -570,6 +570,7 @@
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\n2=tags are inherited");
+ CONFIG_ADD_VAR(MATCH_PERCENT, int, 0, "0=percentage above chance\n1=percentage");
#endif
Modified: branches/hjg-dev/source/main/cTaskLib.cc
===================================================================
--- branches/hjg-dev/source/main/cTaskLib.cc 2008-12-13 21:47:37 UTC (rev 3035)
+++ branches/hjg-dev/source/main/cTaskLib.cc 2008-12-13 22:03:15 UTC (rev 3036)
@@ -36,6 +36,7 @@
#include "cOrgMessagePredicate.h"
#include "cOrgMovementPredicate.h"
+
#include "platform.h"
#include <cstdlib>
@@ -2065,15 +2066,29 @@
}
*/
+ name = "[resets]";
+ // if the organism hasn't donated, then zero out its reputation.
+ if ((ctx.GetOrganism()->GetReputation() > 0) &&
+ (ctx.GetOrganism()->GetNumberOfDonations() == 0)) {
+ ctx.GetOrganism()->SetReputation(0);
+ m_world->GetStats().AddStringBitsMatchedValue(name, 1);
+ }
+
+
+
+
double bonus = 0.0;
// return value between 0 & 1 representing the percentage of string that was matched
+ double base_bonus = 0.0;
- // percent over 50% (Sherri)
- //double base_bonus = static_cast<double>(max_num_matched) * 2.0 / static_cast<double>(string_to_match.GetSize()) - 1;
+ if (m_world->GetConfig().MATCH_PERCENT.Get() == 1) {
+ // percent over 50% (Sherri)
+ base_bonus = static_cast<double>(max_num_matched) * 2.0 / static_cast<double>(string_to_match.GetSize()) - 1;
+ } else if (m_world->GetConfig().MATCH_PERCENT.Get() == 2) {
+ // percent (hjg)
+ base_bonus = static_cast<double>(max_num_matched) / static_cast<double>(string_to_match.GetSize());
+ }
- // percent (hjg)
- double base_bonus = static_cast<double>(max_num_matched) / static_cast<double>(string_to_match.GetSize());
-
if (partial)
{
base_bonus=double(max_num_matched)*2/double(num_real) -1;
More information about the Avida-cvs
mailing list