[Avida-SVN] r2950 - in branches/movement/source: actions main

grabow38 at myxo.css.msu.edu grabow38 at myxo.css.msu.edu
Mon Nov 17 16:51:42 PST 2008


Author: grabow38
Date: 2008-11-17 19:51:42 -0500 (Mon, 17 Nov 2008)
New Revision: 2950

Modified:
   branches/movement/source/actions/PopulationActions.cc
   branches/movement/source/main/cPopulation.cc
Log:
In cActionInjectDemes, added set facing after injecting.  Also removed extraneous debugging output.

Modified: branches/movement/source/actions/PopulationActions.cc
===================================================================
--- branches/movement/source/actions/PopulationActions.cc	2008-11-17 19:54:21 UTC (rev 2949)
+++ branches/movement/source/actions/PopulationActions.cc	2008-11-18 00:51:42 UTC (rev 2950)
@@ -583,8 +583,18 @@
         m_world->GetPopulation().Inject(genome,
                                         m_world->GetPopulation().DemeSelectInjectionCell( m_world->GetPopulation().GetDeme(i), 0),
                                         m_merit, m_lineage_label, m_neutral_metric);
+                
+        //CALL void cPopulation::DemePostInjection(cDeme& deme, cPopulationCell& cell)
+        cDeme& deme =  m_world->GetPopulation().GetDeme(i);
+        cPopulationCell& cell =  m_world->GetPopulation().GetCell( m_world->GetPopulation().DemeSelectInjectionCell( m_world->GetPopulation().GetDeme(i), 0));
+        
+        m_world->GetPopulation().DemePostInjection(deme, cell);
+        
         m_world->GetPopulation().GetDeme(i).IncInjectedCount();
-        
+        // Debugging @ LMG
+        /*cout << "Deme " << deme.GetID() 
+             << " I am facing " << m_world->GetPopulation().GetCell(cell.GetID()).GetCellFaced().GetID()
+             <<  " // Called from end of InjectDemes " << endl;*/
       }
     }
   }

Modified: branches/movement/source/main/cPopulation.cc
===================================================================
--- branches/movement/source/main/cPopulation.cc	2008-11-17 19:54:21 UTC (rev 2949)
+++ branches/movement/source/main/cPopulation.cc	2008-11-18 00:51:42 UTC (rev 2950)
@@ -642,8 +642,12 @@
   
   // @WRE: Tumble the new organism if movement is turned on. 08-Aug-2008
   if (0 != m_world->GetConfig().BIOMIMETIC_MOVEMENT_STEP.Get()) {
-    // This randomizes the initial facing.
-	Tumble(in_organism);
+    // The randomization needs to be turned off if deme facing is specified @ LMG
+    // Unfortunately, a random facing in the deme == case 2
+    if ( m_world->GetConfig().DEMES_ORGANISM_FACING.Get() != 2 ) {
+      // This randomizes the initial facing.
+      Tumble(in_organism);
+      }
   }
 
 }
@@ -713,7 +717,16 @@
       Tumble(src_cell.GetOrganism());
 	}
   }
-  cout << "In MoveOrganisms... Facing ' " << newFacing << endl;
+  // Debugging output LMG
+  //cout << "In MoveOrganisms... Facing ' " << newFacing << endl;
+  
+  // Movement logging of facing @ LMG 16 NOv 2008
+  ofstream movelog;
+  movelog.open("data/movelog.txt",ios::app);
+  movelog << newFacing << endl;
+  movelog.close();
+  // Debugging output
+  //cout << newFacing << endl;
 }
 
 void cPopulation::KillOrganism(cPopulationCell& in_cell)
@@ -952,19 +965,20 @@
 	  int target_cell_id = org1->GetTargetCellID();
 	  int target_x = target_cell_id % world_x;
 	  int target_y = target_cell_id / world_x;
-	  int facing_dir = cell2. GetFacing();
+	  //int facing_dir = cell2. GetFacing();
 		
 	  ofstream movelog;
 	  movelog.open("data/movelog.txt",ios::app);
 	  // By columns: org ID, from cell xy, to cell xy, target x, target y, facing
-    cout << cid << " " <<
+    
+    // Debugging output LMG
+    /* cout << cid << " " <<
     x1 << " " <<
 		y1 << " " <<
 		x << " " <<
 		y << " " <<
 		target_x << " " <<
-		target_y << " " << 
-		facing_dir << endl;
+		target_y << " " ; */
     
 	  movelog << cid << " " <<
 	    x1 << " " <<
@@ -972,8 +986,8 @@
 		x << " " <<
 		y << " " <<
 		target_x << " " <<
-		target_y << " " << 
-		facing_dir << endl;
+		target_y << " " ; //<< 
+		//facing_dir << endl;
 	    movelog.close();
 	}
   } else {
@@ -2296,8 +2310,8 @@
   assert(cellid >= deme.GetCellID(0));
   assert(cellid <= deme.GetCellID(deme.GetSize()-1));
   
-  // @ LMG
-  cout << " Cell ID selected = " << cellid << endl;
+  // Debugging output @ LMG
+  // cout << " Cell ID selected = " << cellid << endl;
   
   return cellid;  
 }
@@ -2336,6 +2350,10 @@
       assert(false);
     }
   }
+  // Debugging @ LMG
+  /*cout << "Deme " << deme.GetID() << " cell " << cell.GetID() << " I should be facing " 
+       << GridNeighbor(cell.GetID()-deme.GetCellID(0), deme.GetWidth(), deme.GetHeight(), 0, -1)+deme.GetCellID(0)
+       << " // Called from end of DemePostInjection " << endl;*/
 }
 
 




More information about the Avida-cvs mailing list