[Avida-SVN] r3404 - in development/source: . main

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Tue Sep 15 13:55:16 PDT 2009


Author: brysonda
Date: 2009-09-15 16:55:15 -0400 (Tue, 15 Sep 2009)
New Revision: 3404

Modified:
   development/source/defs.h
   development/source/main/cPopulation.cc
Log:
Small redundant code cleanup in cPopulation.

Modified: development/source/defs.h
===================================================================
--- development/source/defs.h	2009-09-15 19:13:24 UTC (rev 3403)
+++ development/source/defs.h	2009-09-15 20:55:15 UTC (rev 3404)
@@ -116,7 +116,8 @@
   POSITION_CHILD_PARENT_FACING,
   POSITION_CHILD_NEXT_CELL,
   POSITION_CHILD_FULL_SOUP_ENERGY_USED,
-  POSITION_CHILD_NEIGHBORHOOD_ENERGY_USED
+  POSITION_CHILD_NEIGHBORHOOD_ENERGY_USED,
+  POSITION_CHILD_DISPERSAL,
 };
 const int NUM_LOCAL_POSITION_CHILD = POSITION_CHILD_FULL_SOUP_RANDOM;
 

Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc	2009-09-15 19:13:24 UTC (rev 3403)
+++ development/source/main/cPopulation.cc	2009-09-15 20:55:15 UTC (rev 3404)
@@ -3514,16 +3514,11 @@
   tList<cPopulationCell> found_list;
   
   // First, check if there is an empty organism to work with (always preferred)
-  tList<cPopulationCell> & conn_list = parent_cell.ConnectionList();
+  tList<cPopulationCell>& conn_list = parent_cell.ConnectionList();
   
-  if (m_world->GetConfig().PREFER_EMPTY.Get() == false &&
-      birth_method == POSITION_CHILD_RANDOM) {
-    found_list.Append(conn_list);
-    if (parent_ok == true) found_list.Push(&parent_cell);
-  } else {
-    FindEmptyCell(conn_list, found_list);
-  }
+  if (m_world->GetConfig().PREFER_EMPTY.Get()) FindEmptyCell(conn_list, found_list);
   
+  
   // If we have not found an empty organism, we must use the specified function
   // to determine how to choose among the filled organisms.
   if (found_list.GetSize() == 0) {
@@ -3537,7 +3532,7 @@
       case POSITION_CHILD_RANDOM:
         found_list.Append(conn_list);
         if (parent_ok == true) found_list.Push(&parent_cell);
-          break;
+        break;
       case POSITION_CHILD_NEIGHBORHOOD_ENERGY_USED:
         PositionEnergyUsed(parent_cell, found_list, parent_ok);
       case POSITION_CHILD_EMPTY:




More information about the Avida-cvs mailing list