[Avida-SVN] r1415 - branches/energy/source/main

beckma24 at myxo.css.msu.edu beckma24 at myxo.css.msu.edu
Tue Mar 20 13:08:17 PDT 2007


Author: beckma24
Date: 2007-03-20 16:08:17 -0400 (Tue, 20 Mar 2007)
New Revision: 1415

Modified:
   branches/energy/source/main/cPopulation.cc
   branches/energy/source/main/cPopulation.h
Log:
Fixed buy in decay of energy.
Updated instruction file documentation to show energy cost (last commit).

Modified: branches/energy/source/main/cPopulation.cc
===================================================================
--- branches/energy/source/main/cPopulation.cc	2007-03-20 19:52:09 UTC (rev 1414)
+++ branches/energy/source/main/cPopulation.cc	2007-03-20 20:08:17 UTC (rev 1415)
@@ -78,6 +78,8 @@
   int geometry = world->GetConfig().WORLD_GEOMETRY.Get();
   const int num_cells = world_x * world_y;
   
+  if(m_world->GetConfig().ENERGY_ENABLED.Get()) 
+    sleep_log = new tVector<pair<int,int> >[world_x*world_y];
   // Print out world details
   if (world->GetVerbosity() > VERBOSE_NORMAL) {
     cout << "Building world " << world_x << "x" << world_y << " = " << num_cells << " organisms." << endl;
@@ -338,8 +340,10 @@
     
     // Update the phenotypes of each child....
     const int child_length = child_array[i]->GetGenome().GetSize();
+
     //decay of energy
-    parent_phenotype.ReduceEnergy(parent_phenotype.GetStoredEnergy() * (1 - m_world->GetConfig().FRAC_ENERGY_DECAY_AT_BIRTH.Get()));
+    parent_phenotype.ReduceEnergy(parent_phenotype.GetStoredEnergy() * m_world->GetConfig().FRAC_ENERGY_DECAY_AT_BIRTH.Get());
+
     child_array[i]->GetPhenotype().SetupOffspring(parent_phenotype,child_length);
     
     //TODO -- sexual replication

Modified: branches/energy/source/main/cPopulation.h
===================================================================
--- branches/energy/source/main/cPopulation.h	2007-03-20 19:52:09 UTC (rev 1414)
+++ branches/energy/source/main/cPopulation.h	2007-03-20 20:08:17 UTC (rev 1415)
@@ -94,7 +94,7 @@
   cBirthChamber birth_chamber;         // Global birth chamber.
   tArray<tList<cSaleItem> > market;   // list of lists of items for sale, each list goes with 1 label
 
-  tVector<pair<int,int> > sleep_log[2500];
+  tVector<pair<int,int> > *sleep_log;
   
   // Data Tracking...
   tList<cPopulationCell> reaper_queue; // Death order in some mass-action runs




More information about the Avida-cvs mailing list