[Avida-SVN] r2564 - branches/uml/source/main
hjg at myxo.css.msu.edu
hjg at myxo.css.msu.edu
Wed Apr 30 11:17:20 PDT 2008
Author: hjg
Date: 2008-04-30 14:17:20 -0400 (Wed, 30 Apr 2008)
New Revision: 2564
Modified:
branches/uml/source/main/cTaskLib.cc
Log:
bug fix so that non-determinism task cannot be less than 0.
Modified: branches/uml/source/main/cTaskLib.cc
===================================================================
--- branches/uml/source/main/cTaskLib.cc 2008-04-30 18:07:36 UTC (rev 2563)
+++ branches/uml/source/main/cTaskLib.cc 2008-04-30 18:17:20 UTC (rev 2564)
@@ -3352,6 +3352,7 @@
cOrganism* organism = ctx.getOrganism();
double nd_penalty=0;
double max_bonus=0;
+ double bonus;
for(unsigned int i=0; i<organism->getUMLModel()->getStateDiagramSize(); ++i, ++max_bonus) {
cUMLStateDiagram* sd=organism->getUMLModel()->getStateDiagram(i);
@@ -3360,9 +3361,12 @@
}
}
- organism->getUMLModel()->setBonusInfo("isDeterministic", max_bonus - nd_penalty);
-
- return max_bonus - nd_penalty;
+ bonus = max_bonus - nd_penalty;
+
+ if (bonus < 0) bonus = 0;
+
+ organism->getUMLModel()->setBonusInfo("isDeterministic", bonus);
+ return bonus;
}
// This task will be used to see if an organism meets the criteria for
More information about the Avida-cvs
mailing list