[Avida-SVN] r3055 - branches/hjg-dev/source/main
hjg at myxo.css.msu.edu
hjg at myxo.css.msu.edu
Tue Dec 16 19:43:07 PST 2008
Author: hjg
Date: 2008-12-16 22:43:07 -0500 (Tue, 16 Dec 2008)
New Revision: 3055
Modified:
branches/hjg-dev/source/main/cTaskLib.cc
Log:
added percent match to stringcat
Modified: branches/hjg-dev/source/main/cTaskLib.cc
===================================================================
--- branches/hjg-dev/source/main/cTaskLib.cc 2008-12-17 00:50:26 UTC (rev 3054)
+++ branches/hjg-dev/source/main/cTaskLib.cc 2008-12-17 03:43:07 UTC (rev 3055)
@@ -1975,7 +1975,7 @@
// Update tag
- ctx.GetOrganism()->UpdateTag(0, (int)(max_num_matched/m_strings.size()));
+ ctx.GetOrganism()->UpdateTag(1, (int)(max_num_matched/m_strings.size()));
// Update reputation
ctx.GetOrganism()->SetAverageReputation( (int)(max_num_matched/m_strings.size()));
@@ -1989,7 +1989,17 @@
double bonus = 0.0;
// return value between 0 & 1 representing the percentage of string that was matched
- double base_bonus = static_cast<double>(max_num_matched) * 2.0 / static_cast<double>(string_to_match.GetSize()) - 1;
+ double base_bonus = 0;
+ //static_cast<double>(max_num_matched) * 2.0 / static_cast<double>(string_to_match.GetSize()) - 1;
+ if (m_world->GetConfig().MATCH_PERCENT.Get() == 0) {
+ // 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() == 1) {
+ // percent (hjg)
+ 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