[Avida-SVN] r3456 - in development/source: actions main

beckma24 at myxo.css.msu.edu beckma24 at myxo.css.msu.edu
Thu Oct 8 09:18:28 PDT 2009


Author: beckma24
Date: 2009-10-08 12:18:28 -0400 (Thu, 08 Oct 2009)
New Revision: 3456

Modified:
   development/source/actions/PopulationActions.cc
   development/source/main/cStats.cc
   development/source/main/cStats.h
Log:
Added column to orgs_killed.dat that displayed number of unoccupied cells where a kill was attempted.

Modified: development/source/actions/PopulationActions.cc
===================================================================
--- development/source/actions/PopulationActions.cc	2009-10-08 15:07:42 UTC (rev 3455)
+++ development/source/actions/PopulationActions.cc	2009-10-08 16:18:28 UTC (rev 3456)
@@ -4069,8 +4069,14 @@
               }
               
               current_cell = (world_x * row_adj) + col_adj;
-              pop.KillOrganism(pop.GetCell(current_cell));
-              m_world->GetStats().IncNumOrgsKilled();
+							cPopulationCell& cell = pop.GetCell(current_cell);
+							if (cell.IsOccupied()) {
+								pop.KillOrganism(cell);
+								m_world->GetStats().IncNumOrgsKilled();
+							} else {
+								m_world->GetStats().IncNumUnoccupiedCellAttemptedToKill();
+							}
+
             }
           }
           

Modified: development/source/main/cStats.cc
===================================================================
--- development/source/main/cStats.cc	2009-10-08 15:07:42 UTC (rev 3455)
+++ development/source/main/cStats.cc	2009-10-08 16:18:28 UTC (rev 3456)
@@ -135,6 +135,7 @@
   , m_spec_num(0)
   , m_spec_waste(0)
   , num_orgs_killed(0)
+	, num_unoccupied_cell_kill_attempts(0)
   , num_migrations(0)
   , m_deme_num_repls(0)
 	, m_deme_num_repls_treatable(0)
@@ -579,6 +580,7 @@
   m_spec_waste = 0;
   
   num_orgs_killed = 0;
+	num_unoccupied_cell_kill_attempts = 0;
   num_migrations = 0;
 }
 
@@ -2480,6 +2482,7 @@
   
   df.Write(m_update,   "Update");
   df.Write(num_orgs_killed, "Num Orgs Killed");
+  df.Write(num_unoccupied_cell_kill_attempts, "Num Unoccupied Cell Kill Attempts");
   df.Endl();
 } //End PrintNumOrgsKilledData()
 

Modified: development/source/main/cStats.h
===================================================================
--- development/source/main/cStats.h	2009-10-08 15:07:42 UTC (rev 3455)
+++ development/source/main/cStats.h	2009-10-08 16:18:28 UTC (rev 3456)
@@ -338,6 +338,7 @@
   
   // Number of organisms killed by kill actions
   int num_orgs_killed;
+	int num_unoccupied_cell_kill_attempts;
   
   // Number of migrations that have been made
   int num_migrations;
@@ -571,6 +572,7 @@
   void IncExecuted() { num_executed++; }
   
   void IncNumOrgsKilled() { num_orgs_killed++; }
+	void IncNumUnoccupiedCellAttemptedToKill() { num_unoccupied_cell_kill_attempts++; }
   void IncNumMigrations() { num_migrations++; }
 
   void AddCurTask(int task_num) { task_cur_count[task_num]++; }




More information about the Avida-cvs mailing list