[Avida-SVN] r2176 - in branches/energy: Avida.xcodeproj source/cpu

welsberr at myxo.css.msu.edu welsberr at myxo.css.msu.edu
Fri Nov 2 12:17:17 PDT 2007


Author: welsberr
Date: 2007-11-02 15:17:17 -0400 (Fri, 02 Nov 2007)
New Revision: 2176

Modified:
   branches/energy/Avida.xcodeproj/project.pbxproj
   branches/energy/source/cpu/cHardwareCPU.cc
   branches/energy/source/cpu/cHardwareCPU.h
Log:
Added sense3-and-rotate instruction

Modified: branches/energy/Avida.xcodeproj/project.pbxproj
===================================================================
--- branches/energy/Avida.xcodeproj/project.pbxproj	2007-11-02 11:14:50 UTC (rev 2175)
+++ branches/energy/Avida.xcodeproj/project.pbxproj	2007-11-02 19:17:17 UTC (rev 2176)
@@ -213,23 +213,6 @@
 		};
 /* End PBXBuildRule section */
 
-/* Begin PBXBuildStyle section */
-		B5195F300C95A1D400E398BD /* Development */ = {
-			isa = PBXBuildStyle;
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-			};
-			name = Development;
-		};
-		B5195F310C95A1D400E398BD /* Deployment */ = {
-			isa = PBXBuildStyle;
-			buildSettings = {
-				COPY_PHASE_STRIP = YES;
-			};
-			name = Deployment;
-		};
-/* End PBXBuildStyle section */
-
 /* Begin PBXContainerItemProxy section */
 		56F555DA0C3B36FC00E2E929 /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
@@ -1800,12 +1783,6 @@
 		DCC30C4D0762532C008F7A48 /* Project object */ = {
 			isa = PBXProject;
 			buildConfigurationList = 702442D70859E0B00059BD9B /* Build configuration list for PBXProject "Avida" */;
-			buildSettings = {
-			};
-			buildStyles = (
-				B5195F300C95A1D400E398BD /* Development */,
-				B5195F310C95A1D400E398BD /* Deployment */,
-			);
 			hasScannedForEncodings = 0;
 			mainGroup = DCC30C490762532C008F7A48;
 			productRefGroup = DCC3164E07626CF3008F7A48 /* Products */;

Modified: branches/energy/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/energy/source/cpu/cHardwareCPU.cc	2007-11-02 11:14:50 UTC (rev 2175)
+++ branches/energy/source/cpu/cHardwareCPU.cc	2007-11-02 19:17:17 UTC (rev 2176)
@@ -235,7 +235,9 @@
     // @WRE additions for movement
     tInstLibEntry<tMethod>("tumble", &cHardwareCPU::Inst_Tumble),
     tInstLibEntry<tMethod>("move", &cHardwareCPU::Inst_Move),
-    
+    // Addition for follow-the-leader
+	tInstLibEntry<tMethod>("sense3-and-rotate", &cHardwareCPU::Inst_Sense3andRotate),
+	
     // Threading instructions
     tInstLibEntry<tMethod>("fork-th", &cHardwareCPU::Inst_ForkThread),
     tInstLibEntry<tMethod>("forkl", &cHardwareCPU::Inst_ForkThreadLabel),
@@ -3809,6 +3811,41 @@
   return true;
 }
 
+// Addition for follow-the-leader
+bool cHardwareCPU::Inst_Sense3andRotate(cAvidaContext& ctx)
+{
+   int left, right, center;
+   cPopulationCell mycell;
+   
+   // Get population
+   cPopulation& pop = m_world->GetPopulation();
+
+   // Fill in left, right, center with m_cell_data via GetCellData()
+   // GetRegister(out_reg) = m_world->GetPopulation().GetCell(cellID).GetCellData();
+   mycell =  m_world->GetPopulation().GetCell(organism->GetCellID());
+   center = mycell.GetCellFaced().GetCellData();
+   left = mycell.ConnectionList().GetLast()->GetCellData();
+   right = mycell.ConnectionList().GetFirst()->GetCellData();
+
+   // Register loading in future
+   // Take differences
+   // Issue appropriate rotate command
+   if ((center >= left) && (center >= right)) { // do nothing
+   } else if (left > right) {
+      // Turn left
+	  mycell.ConnectionList().CircPrev();
+   } else if (right > left) {
+      // Turn right
+	  mycell.ConnectionList().CircNext();
+   } else {
+      // Turn right
+	  mycell.ConnectionList().CircNext();
+   }
+
+   return true;   
+}
+
+
 // @WRE addition for movement
 // Tumble sets the organism and cell to a new random facing
 // 

Modified: branches/energy/source/cpu/cHardwareCPU.h
===================================================================
--- branches/energy/source/cpu/cHardwareCPU.h	2007-11-02 11:14:50 UTC (rev 2175)
+++ branches/energy/source/cpu/cHardwareCPU.h	2007-11-02 19:17:17 UTC (rev 2176)
@@ -481,6 +481,8 @@
   // @WRE additions for movement
   bool Inst_Tumble(cAvidaContext& ctx);
   bool Inst_Move(cAvidaContext& ctx);
+  // Additions for follow-the-leader
+  bool Inst_Sense3andRotate(cAvidaContext& ctx);
 
   // Multi-threading...
 




More information about the Avida-cvs mailing list