[Avida-cvs] [avida-svn] r501 - branches/jeffdev/source/cpu
jclune@myxo.css.msu.edu
jclune at myxo.css.msu.edu
Thu Mar 9 21:35:08 PST 2006
Author: jclune
Date: 2006-03-10 00:35:08 -0500 (Fri, 10 Mar 2006)
New Revision: 501
Modified:
branches/jeffdev/source/cpu/cHardwareCPU.cc
Log:
added a check that an organism is not making a donation that makes their merit negative. now, if they try to do that, their merit will end up as zero instead of negative.
Modified: branches/jeffdev/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/jeffdev/source/cpu/cHardwareCPU.cc 2006-03-10 03:55:47 UTC (rev 500)
+++ branches/jeffdev/source/cpu/cHardwareCPU.cc 2006-03-10 05:35:08 UTC (rev 501)
@@ -2883,7 +2883,8 @@
const double merit_received = cConfig::GetMeritReceived();
double cur_merit = organism->GetPhenotype().GetMerit().GetDouble();
- cur_merit -= merit_given;
+ cur_merit -= merit_given;
+ if(cur_merit < 0) cur_merit=0;
// Plug the current merit back into this organism and notify the scheduler.
organism->UpdateMerit(cur_merit);
More information about the Avida-cvs
mailing list