[Avida-SVN] r2685 - in branches/uml-merge: Avida.xcodeproj source/actions source/cpu source/main source/orchid

dk at myxo.css.msu.edu dk at myxo.css.msu.edu
Wed Jun 25 07:04:42 PDT 2008


Author: dk
Date: 2008-06-25 10:04:41 -0400 (Wed, 25 Jun 2008)
New Revision: 2685

Added:
   branches/uml-merge/source/orchid/cOrchidFactory.cc
   branches/uml-merge/source/orchid/cOrchidFactory.h
   branches/uml-merge/source/orchid/cOrchidOrganism.cc
   branches/uml-merge/source/orchid/cOrchidOrganism.h
   branches/uml-merge/source/orchid/cOrchidPopulation.h
Modified:
   branches/uml-merge/Avida.xcodeproj/project.pbxproj
   branches/uml-merge/source/actions/PrintActions.cc
   branches/uml-merge/source/cpu/cHardwareOrchid.cc
   branches/uml-merge/source/main/cAvidaConfig.h
   branches/uml-merge/source/main/cBirthChamber.cc
   branches/uml-merge/source/main/cOrganism.cc
   branches/uml-merge/source/main/cOrganism.h
   branches/uml-merge/source/main/cPopulation.cc
   branches/uml-merge/source/main/cPopulation.h
   branches/uml-merge/source/main/cStats.cc
   branches/uml-merge/source/main/cStats.h
   branches/uml-merge/source/main/cTaskLib.cc
   branches/uml-merge/source/main/cTaskLib.h
Log:
Added orchid organism, population, factory.  All normal Avida consistency tests pass.

Modified: branches/uml-merge/Avida.xcodeproj/project.pbxproj
===================================================================
--- branches/uml-merge/Avida.xcodeproj/project.pbxproj	2008-06-24 18:01:14 UTC (rev 2684)
+++ branches/uml-merge/Avida.xcodeproj/project.pbxproj	2008-06-25 14:04:41 UTC (rev 2685)
@@ -54,6 +54,11 @@
 		424EE6540E0F0E0800E6E1C7 /* cUMLStateDiagram.h in Headers */ = {isa = PBXBuildFile; fileRef = 424EE6390E0F0E0800E6E1C7 /* cUMLStateDiagram.h */; };
 		424EE6570E0F0E3300E6E1C7 /* cHardwareOrchid.cc in Sources */ = {isa = PBXBuildFile; fileRef = 424EE6550E0F0E3300E6E1C7 /* cHardwareOrchid.cc */; };
 		424EE6580E0F0E3300E6E1C7 /* cHardwareOrchid.h in Headers */ = {isa = PBXBuildFile; fileRef = 424EE6560E0F0E3300E6E1C7 /* cHardwareOrchid.h */; };
+		42510BAB0E1166A70058A813 /* cOrchidFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 42510BAA0E1166A70058A813 /* cOrchidFactory.h */; };
+		42948E410E1276BC000BEEDE /* cOrchidOrganism.h in Headers */ = {isa = PBXBuildFile; fileRef = 42948E3F0E1276BC000BEEDE /* cOrchidOrganism.h */; };
+		42948E420E1276BC000BEEDE /* cOrchidPopulation.h in Headers */ = {isa = PBXBuildFile; fileRef = 42948E400E1276BC000BEEDE /* cOrchidPopulation.h */; };
+		42948E4D0E1278A2000BEEDE /* cOrchidFactory.cc in Sources */ = {isa = PBXBuildFile; fileRef = 42948E4C0E1278A2000BEEDE /* cOrchidFactory.cc */; };
+		42948E520E127A18000BEEDE /* cOrchidOrganism.cc in Sources */ = {isa = PBXBuildFile; fileRef = 42948E510E127A18000BEEDE /* cOrchidOrganism.cc */; };
 		5629D8110C3EE14800C5F152 /* cTextWindow.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5629D80D0C3EE13500C5F152 /* cTextWindow.cc */; };
 		5629D8180C3EE20C00C5F152 /* libncurses.5.4.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 70658C59085DF67D00486BED /* libncurses.5.4.dylib */; };
 		5629D8190C3EE21300C5F152 /* libavida-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7023EC330C0A426900362B9C /* libavida-core.a */; };
@@ -425,7 +430,12 @@
 		424EE6390E0F0E0800E6E1C7 /* cUMLStateDiagram.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cUMLStateDiagram.h; sourceTree = "<group>"; };
 		424EE6550E0F0E3300E6E1C7 /* cHardwareOrchid.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cHardwareOrchid.cc; sourceTree = "<group>"; };
 		424EE6560E0F0E3300E6E1C7 /* cHardwareOrchid.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; path = cHardwareOrchid.h; sourceTree = "<group>"; tabWidth = 2; usesTabs = 1; };
+		42510BAA0E1166A70058A813 /* cOrchidFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cOrchidFactory.h; sourceTree = "<group>"; };
 		42777E5B0C7F123600AFA4ED /* cOrgMessage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cOrgMessage.h; sourceTree = "<group>"; };
+		42948E3F0E1276BC000BEEDE /* cOrchidOrganism.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cOrchidOrganism.h; sourceTree = "<group>"; };
+		42948E400E1276BC000BEEDE /* cOrchidPopulation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cOrchidPopulation.h; sourceTree = "<group>"; };
+		42948E4C0E1278A2000BEEDE /* cOrchidFactory.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cOrchidFactory.cc; sourceTree = "<group>"; };
+		42948E510E127A18000BEEDE /* cOrchidOrganism.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cOrchidOrganism.cc; sourceTree = "<group>"; };
 		5629D80D0C3EE13500C5F152 /* cTextWindow.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cTextWindow.cc; sourceTree = "<group>"; };
 		5629D80E0C3EE13500C5F152 /* cTextWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cTextWindow.h; sourceTree = "<group>"; };
 		5629D80F0C3EE13500C5F152 /* ncurses-defs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "ncurses-defs.h"; sourceTree = "<group>"; };
@@ -921,7 +931,7 @@
 		DCC315CE076253A5008F7A48 /* environment.rotate */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = environment.rotate; sourceTree = "<group>"; };
 		DCC315D0076253A5008F7A48 /* task_event_gen.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = task_event_gen.cc; sourceTree = "<group>"; };
 		DCC315D1076253A5008F7A48 /* task_event_gen.old.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = task_event_gen.old.cc; sourceTree = "<group>"; };
-		DCC3164D07626CF3008F7A48 /* avida */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = avida; sourceTree = BUILT_PRODUCTS_DIR; };
+		DCC3164D07626CF3008F7A48 /* avida */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = avida; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -1017,6 +1027,11 @@
 				424EE6370E0F0E0800E6E1C7 /* cUMLModel.h */,
 				424EE6380E0F0E0800E6E1C7 /* cUMLStateDiagram.cc */,
 				424EE6390E0F0E0800E6E1C7 /* cUMLStateDiagram.h */,
+				42510BAA0E1166A70058A813 /* cOrchidFactory.h */,
+				42948E4C0E1278A2000BEEDE /* cOrchidFactory.cc */,
+				42948E3F0E1276BC000BEEDE /* cOrchidOrganism.h */,
+				42948E510E127A18000BEEDE /* cOrchidOrganism.cc */,
+				42948E400E1276BC000BEEDE /* cOrchidPopulation.h */,
 			);
 			path = orchid;
 			sourceTree = "<group>";
@@ -1782,6 +1797,9 @@
 				424EE6520E0F0E0800E6E1C7 /* cUMLModel.h in Headers */,
 				424EE6540E0F0E0800E6E1C7 /* cUMLStateDiagram.h in Headers */,
 				424EE6580E0F0E3300E6E1C7 /* cHardwareOrchid.h in Headers */,
+				42510BAB0E1166A70058A813 /* cOrchidFactory.h in Headers */,
+				42948E410E1276BC000BEEDE /* cOrchidOrganism.h in Headers */,
+				42948E420E1276BC000BEEDE /* cOrchidPopulation.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1930,6 +1948,7 @@
 		DCC30C4D0762532C008F7A48 /* Project object */ = {
 			isa = PBXProject;
 			buildConfigurationList = 702442D70859E0B00059BD9B /* Build configuration list for PBXProject "Avida" */;
+			compatibilityVersion = "Xcode 2.4";
 			hasScannedForEncodings = 0;
 			mainGroup = DCC30C490762532C008F7A48;
 			productRefGroup = DCC3164E07626CF3008F7A48 /* Products */;
@@ -2143,6 +2162,8 @@
 				424EE6510E0F0E0800E6E1C7 /* cUMLModel.cc in Sources */,
 				424EE6530E0F0E0800E6E1C7 /* cUMLStateDiagram.cc in Sources */,
 				424EE6570E0F0E3300E6E1C7 /* cHardwareOrchid.cc in Sources */,
+				42948E4D0E1278A2000BEEDE /* cOrchidFactory.cc in Sources */,
+				42948E520E127A18000BEEDE /* cOrchidOrganism.cc in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: branches/uml-merge/source/actions/PrintActions.cc
===================================================================
--- branches/uml-merge/source/actions/PrintActions.cc	2008-06-24 18:01:14 UTC (rev 2684)
+++ branches/uml-merge/source/actions/PrintActions.cc	2008-06-25 14:04:41 UTC (rev 2685)
@@ -39,6 +39,7 @@
 #include "cHistogram.h"
 #include "cInjectGenotype.h"
 #include "cInstSet.h"
+#include "cOrchidOrganism.h"
 #include "cOrganism.h"
 #include "cPhenPlastGenotype.h"
 #include "cPlasticPhenotype.h"
@@ -2529,7 +2530,7 @@
 				
 				if(cell.IsOccupied()) {
 					// then need to call something on the model that determines its value...
-					uml_val = cell.GetOrganism()->GetUMLModel()->GetUMLValue();
+					uml_val = cell.GetOrganism()->GetOrchidOrganism()->GetUMLModel()->GetUMLValue();
 					//				uml_val = 0;
 				} else {
 					uml_val = -1;

Modified: branches/uml-merge/source/cpu/cHardwareOrchid.cc
===================================================================
--- branches/uml-merge/source/cpu/cHardwareOrchid.cc	2008-06-24 18:01:14 UTC (rev 2684)
+++ branches/uml-merge/source/cpu/cHardwareOrchid.cc	2008-06-25 14:04:41 UTC (rev 2685)
@@ -38,6 +38,8 @@
 #include "cMutation.h"
 #include "cMutationLib.h"
 #include "nMutation.h"
+#include "cOrchidOrganism.h"
+#include "cOrchidPopulation.h"
 #include "cOrganism.h"
 #include "cOrgMessage.h"
 #include "cPhenotype.h"
@@ -68,7 +70,7 @@
     cString name;
     int nop_mod;
     cNOPEntryCPU(const cString &name, int nop_mod)
-      : name(name), nop_mod(nop_mod) {}
+    : name(name), nop_mod(nop_mod) {}
   };
   static const cNOPEntryCPU s_n_array[] = {
     cNOPEntryCPU("nop-A", REG_AX),
@@ -108,7 +110,7 @@
     tInstLibEntry<tMethod>("jump-b", &cHardwareOrchid::Inst_JumpB),
     tInstLibEntry<tMethod>("call", &cHardwareOrchid::Inst_Call),
     tInstLibEntry<tMethod>("return", &cHardwareOrchid::Inst_Return),
-
+    
     tInstLibEntry<tMethod>("throw", &cHardwareOrchid::Inst_Throw),
     tInstLibEntry<tMethod>("throwif=0", &cHardwareOrchid::Inst_ThrowIf0),    
     tInstLibEntry<tMethod>("throwif!=0", &cHardwareOrchid::Inst_ThrowIfNot0),
@@ -214,7 +216,7 @@
     tInstLibEntry<tMethod>("kill-cell-event", &cHardwareOrchid::Inst_KillCellEvent, nInstFlag::STALL),
     tInstLibEntry<tMethod>("kill-faced-cell-event", &cHardwareOrchid::Inst_KillFacedCellEvent, nInstFlag::STALL),
     tInstLibEntry<tMethod>("collect-cell-data-and-kill-event", &cHardwareOrchid::Inst_CollectCellDataAndKillEvent, nInstFlag::STALL),
-
+    
     tInstLibEntry<tMethod>("donate-rnd", &cHardwareOrchid::Inst_DonateRandom, nInstFlag::STALL),
     tInstLibEntry<tMethod>("donate-kin", &cHardwareOrchid::Inst_DonateKin, nInstFlag::STALL),
     tInstLibEntry<tMethod>("donate-edt", &cHardwareOrchid::Inst_DonateEditDist, nInstFlag::STALL),
@@ -227,7 +229,7 @@
     
     tInstLibEntry<tMethod>("IObuf-add1", &cHardwareOrchid::Inst_IOBufAdd1, nInstFlag::STALL),
     tInstLibEntry<tMethod>("IObuf-add0", &cHardwareOrchid::Inst_IOBufAdd0, nInstFlag::STALL),
-
+    
     tInstLibEntry<tMethod>("rotate-l", &cHardwareOrchid::Inst_RotateL, nInstFlag::STALL),
     tInstLibEntry<tMethod>("rotate-r", &cHardwareOrchid::Inst_RotateR, nInstFlag::STALL),
     tInstLibEntry<tMethod>("rotate-left-one", &cHardwareOrchid::Inst_RotateLeftOne, nInstFlag::STALL),
@@ -244,7 +246,7 @@
     tInstLibEntry<tMethod>("get-cell-x", &cHardwareOrchid::Inst_GetCellPositionX),
     tInstLibEntry<tMethod>("get-cell-y", &cHardwareOrchid::Inst_GetCellPositionY),
     tInstLibEntry<tMethod>("dist-from-diag", &cHardwareOrchid::Inst_GetDistanceFromDiagonal),
-
+    
     // @WRE additions for movement
     tInstLibEntry<tMethod>("tumble", &cHardwareOrchid::Inst_Tumble, nInstFlag::STALL),
     tInstLibEntry<tMethod>("move", &cHardwareOrchid::Inst_Move, nInstFlag::STALL),
@@ -355,10 +357,10 @@
     tInstLibEntry<tMethod>("repro-X", &cHardwareOrchid::Inst_Repro, nInstFlag::STALL),
     tInstLibEntry<tMethod>("repro-Y", &cHardwareOrchid::Inst_Repro, nInstFlag::STALL),
     tInstLibEntry<tMethod>("repro-Z", &cHardwareOrchid::Inst_Repro, nInstFlag::STALL),
-
+    
     tInstLibEntry<tMethod>("put-repro", &cHardwareOrchid::Inst_TaskPutRepro, nInstFlag::STALL),
     tInstLibEntry<tMethod>("metabolize", &cHardwareOrchid::Inst_TaskPutResetInputsRepro, nInstFlag::STALL),        
-
+    
     tInstLibEntry<tMethod>("sterilize", &cHardwareOrchid::Inst_Sterilize),
     
     tInstLibEntry<tMethod>("spawn-deme", &cHardwareOrchid::Inst_SpawnDeme, nInstFlag::STALL),
@@ -370,8 +372,8 @@
     tInstLibEntry<tMethod>("relinquishEnergyToFutureDeme", &cHardwareOrchid::Inst_RelinquishEnergyToFutureDeme, nInstFlag::STALL),
     tInstLibEntry<tMethod>("relinquishEnergyToNeighborOrganisms", &cHardwareOrchid::Inst_RelinquishEnergyToNeighborOrganisms, nInstFlag::STALL),
     tInstLibEntry<tMethod>("relinquishEnergyToOrganismsInDeme", &cHardwareOrchid::Inst_RelinquishEnergyToOrganismsInDeme, nInstFlag::STALL),
-
-
+    
+    
     // Sleep and time
     tInstLibEntry<tMethod>("sleep", &cHardwareOrchid::Inst_Sleep, nInstFlag::STALL),
     tInstLibEntry<tMethod>("sleep1", &cHardwareOrchid::Inst_Sleep, nInstFlag::STALL),
@@ -390,7 +392,7 @@
     tInstLibEntry<tMethod>("s-regulate", &cHardwareOrchid::Inst_SenseRegulate),
     tInstLibEntry<tMethod>("numberate", &cHardwareOrchid::Inst_Numberate),
     tInstLibEntry<tMethod>("numberate-24", &cHardwareOrchid::Inst_Numberate24),
-
+    
     // Bit Consensus
     tInstLibEntry<tMethod>("bit-cons", &cHardwareOrchid::Inst_BitConsensus),
     tInstLibEntry<tMethod>("bit-cons-24", &cHardwareOrchid::Inst_BitConsensus24),
@@ -398,16 +400,16 @@
     tInstLibEntry<tMethod>("if-cons-24", &cHardwareOrchid::Inst_IfConsensus24, 0, "Execute next instruction if ?BX[0:23]? in consensus , else skip it"),
     tInstLibEntry<tMethod>("if-less-cons", &cHardwareOrchid::Inst_IfLessConsensus, 0, "Execute next instruction if Count(?BX?) < Count(?CX?), else skip it"),
     tInstLibEntry<tMethod>("if-less-cons-24", &cHardwareOrchid::Inst_IfLessConsensus24, 0, "Execute next instruction if Count(?BX[0:23]?) < Count(?CX[0:23]?), else skip it"),
-
+    
     // Energy usage
     tInstLibEntry<tMethod>("double-energy-usage", &cHardwareOrchid::Inst_DoubleEnergyUsage, nInstFlag::STALL),
     tInstLibEntry<tMethod>("half-energy-usage", &cHardwareOrchid::Inst_HalfEnergyUsage, nInstFlag::STALL),
     tInstLibEntry<tMethod>("default-energy-usage", &cHardwareOrchid::Inst_DefaultEnergyUsage, nInstFlag::STALL),
-
+    
     // Messaging
     tInstLibEntry<tMethod>("send-msg", &cHardwareOrchid::Inst_SendMessage, nInstFlag::STALL),
     tInstLibEntry<tMethod>("retrieve-msg", &cHardwareOrchid::Inst_RetrieveMessage, nInstFlag::STALL),
-
+    
     // Alarms
     tInstLibEntry<tMethod>("send-alarm-msg-local", &cHardwareOrchid::Inst_Alarm_MSG_local, nInstFlag::STALL),
     tInstLibEntry<tMethod>("send-alarm-msg-multihop", &cHardwareOrchid::Inst_Alarm_MSG_multihop, nInstFlag::STALL),
@@ -415,11 +417,11 @@
     tInstLibEntry<tMethod>("send-alarm-msg-bit-cons24-multihop", &cHardwareOrchid::Inst_Alarm_MSG_Bit_Cons24_multihop, nInstFlag::STALL),
     tInstLibEntry<tMethod>("alarm-label-high", &cHardwareOrchid::Inst_Alarm_Label),
     tInstLibEntry<tMethod>("alarm-label-low", &cHardwareOrchid::Inst_Alarm_Label),
-
-
+    
+    
     // Placebo instructions
     tInstLibEntry<tMethod>("skip", &cHardwareOrchid::Inst_Skip),
-
+    
     // @BDC additions for pheromones
     tInstLibEntry<tMethod>("phero-on", &cHardwareOrchid::Inst_PheroOn),
     tInstLibEntry<tMethod>("phero-off", &cHardwareOrchid::Inst_PheroOff),
@@ -444,7 +446,7 @@
     tInstLibEntry<tMethod>("if-pheromone", &cHardwareOrchid::Inst_IfPheromone),
     tInstLibEntry<tMethod>("if-not-pheromone", &cHardwareOrchid::Inst_IfNotPheromone),
     tInstLibEntry<tMethod>("drop-pheromone", &cHardwareOrchid::Inst_DropPheromone, nInstFlag::STALL),
-
+    
     // UML Element Creation			
     /*	tInstLibEntry<tMethod>("addState", &cHardwareOrchid::Inst_AddState, false, 
      "Add a new state"),
@@ -735,7 +737,7 @@
   const int f_size = sizeof(s_f_array)/sizeof(tInstLibEntry<tMethod>);
   static tMethod functions[f_size];
   for (int i = 0; i < f_size; i++) functions[i] = s_f_array[i].GetFunction();
-
+  
 	const int def = 0;
   const int null_inst = f_size - 1;
   
@@ -784,7 +786,7 @@
   m_has_ft_costs = hardware_cpu.m_has_ft_costs;
   m_has_energy_costs = hardware_cpu.m_has_energy_costs;
 #endif
-
+  
 }
 
 
@@ -812,15 +814,15 @@
   m_mal_active = false;
   m_executedmatchstrings = false;
   
-
+  
   ResetInstructionCosts();
-
+  
   // Promoter model
   if (m_world->GetConfig().PROMOTERS_ENABLED.Get())
   {
     // Ideally, this shouldn't be hard-coded
     cInstruction promoter_inst = m_world->GetHardwareManager().GetInstSet().GetInst(cStringUtil::Stringf("promoter"));
-
+    
     m_promoter_index = -1; // Meaning the last promoter was nothing
     m_promoter_offset = 0;
     m_promoters.Resize(0);
@@ -866,7 +868,7 @@
 bool cHardwareOrchid::SingleProcess(cAvidaContext& ctx, bool speculative)
 {
   assert(!speculative || (speculative && !m_thread_slicing_parallel));
-
+  
   int last_IP_pos = IP().GetPosition();
   
   // Mark this organism as running...
@@ -877,7 +879,7 @@
     organism->SetRunning(false);
     return false;
   }
-
+  
   cPhenotype& phenotype = organism->GetPhenotype();
   
   // First instruction - check whether we should be starting at a promoter, when enabled.
@@ -886,7 +888,7 @@
   // Count the cpu cycles used
   phenotype.IncCPUCyclesUsed();
   if (!m_world->GetConfig().NO_CPU_CYCLE_TIME.Get()) phenotype.IncTimeUsed();
-
+  
   const int num_threads = m_threads.GetSize();
   
   // If we have threads turned on and we executed each thread in a single
@@ -926,20 +928,20 @@
     // Test if costs have been paid and it is okay to execute this now...
     bool exec = true;
     if (m_has_any_costs) exec = SingleProcess_PayCosts(ctx, cur_inst);
-
+    
     // Constitutive regulation applied here
     if (m_constituative_regulation) Inst_SenseRegulate(ctx); 
-
+    
     // If there are no active promoters and a certain mode is set, then don't execute any further instructions
     if (m_promoters_enabled && m_world->GetConfig().NO_ACTIVE_PROMOTER_EFFECT.Get() == 2 && m_promoter_index == -1) exec = false;
-  
+    
     // Now execute the instruction...
     if (exec == true) {
       // NOTE: This call based on the cur_inst must occur prior to instruction
       //       execution, because this instruction reference may be invalid after
       //       certain classes of instructions (namely divide instructions) @DMB
       const int time_cost = m_inst_set->GetAddlTimeCost(cur_inst);
-
+      
       // Prob of exec (moved from SingleProcess_PayCosts so that we advance IP after a fail)
       if (m_inst_set->GetProbFail(cur_inst) > 0.0) {
         exec = !( ctx.GetRandom().P(m_inst_set->GetProbFail(cur_inst)) );
@@ -947,7 +949,7 @@
       
       // Add to the promoter inst executed count before executing the inst (in case it is a terminator)
       if (m_promoters_enabled) m_threads[m_cur_thread].IncPromoterInstExecuted();
-
+      
       if (exec == true) SingleProcess_ExecuteInst(ctx, cur_inst);
       
       // Some instruction (such as jump) may turn m_advance_ip off.  Usually
@@ -956,7 +958,7 @@
       
       // Pay the time cost of the instruction now
       phenotype.IncTimeUsed(time_cost);
-            
+      
       // In the promoter model, we may force termination after a certain number of inst have been executed
       if (m_promoters_enabled) {
         const double processivity = m_world->GetConfig().PROMOTER_PROCESSIVITY.Get();
@@ -964,11 +966,11 @@
         if (m_world->GetConfig().PROMOTER_INST_MAX.Get() && (m_threads[m_cur_thread].GetPromoterInstExecuted() >= m_world->GetConfig().PROMOTER_INST_MAX.Get())) 
           Inst_Terminate(ctx);
       }
-
+      
     } // if exec
-        
+    
   } // Previous was executed once for each thread...
-
+  
   // Kill creatures who have reached their max num of instructions executed
   const int max_executed = organism->GetMaxExecuted();
   if ((max_executed > 0 && phenotype.GetTimeUsed() >= max_executed) || phenotype.GetToDie() == true) {
@@ -996,7 +998,7 @@
   // If there is an execution error, execute a random instruction.
   if (organism->TestExeErr()) actual_inst = m_inst_set->GetRandomInst(ctx);
 #endif /* EXECUTION_ERRORS */
-    
+  
   // Get a pointer to the corresponding method...
   int inst_idx = m_inst_set->GetLibFunctionIndex(actual_inst);
   
@@ -1011,9 +1013,9 @@
 	
   // And execute it.
   const bool exec_success = (this->*(m_functions[inst_idx]))(ctx);
-
+  
   // NOTE: Organism may be dead now if instruction executed killed it (such as some divides, "die", or "kazi")
-
+  
 #if INSTRUCTION_COUNT
   // Decrement if the instruction was not executed successfully.
   if (exec_success == false) {
@@ -1072,11 +1074,11 @@
   fp << endl;
   
   fp << "  R-Head:" << GetHead(nHardware::HEAD_READ).GetPosition() << " "
-    << "W-Head:" << GetHead(nHardware::HEAD_WRITE).GetPosition()  << " "
-    << "F-Head:" << GetHead(nHardware::HEAD_FLOW).GetPosition()   << "  "
-    << "RL:" << GetReadLabel().AsString() << "   "
-    << endl;
-    
+  << "W-Head:" << GetHead(nHardware::HEAD_WRITE).GetPosition()  << " "
+  << "F-Head:" << GetHead(nHardware::HEAD_FLOW).GetPosition()   << "  "
+  << "RL:" << GetReadLabel().AsString() << "   "
+  << endl;
+  
   int number_of_stacks = GetNumStacks();
   for (int stack_id = 0; stack_id < number_of_stacks; stack_id++) {
     fp << ((m_threads[m_cur_thread].cur_stack == stack_id) ? '*' : ' ') << " Stack " << stack_id << ":" << setbase(16) << setfill('0');
@@ -1085,9 +1087,9 @@
   }
   
   fp << "  Mem (" << m_memory.GetSize() << "):"
-		  << "  " << m_memory.AsString()
-		  << endl;
-      
+  << "  " << m_memory.AsString()
+  << endl;
+  
   if (m_world->GetConfig().PROMOTERS_ENABLED.Get())
   {
     fp << "  Promoters: index=" << m_promoter_index << " offset=" << m_promoter_offset;
@@ -1160,7 +1162,7 @@
 // to find search label's match inside another label.
 
 int cHardwareOrchid::FindLabel_Forward(const cCodeLabel & search_label,
-                                    const cGenome & search_genome, int pos)
+                                       const cGenome & search_genome, int pos)
 {
   assert (pos < search_genome.GetSize() && pos >= 0);
   
@@ -1242,7 +1244,7 @@
 // to find search label's match inside another label.
 
 int cHardwareOrchid::FindLabel_Backward(const cCodeLabel & search_label,
-                                     const cGenome & search_genome, int pos)
+                                        const cGenome & search_genome, int pos)
 {
   assert (pos < search_genome.GetSize());
   
@@ -1561,7 +1563,7 @@
 bool cHardwareOrchid::Allocate_Random(cAvidaContext& ctx, const int old_size, const int new_size)
 {
   m_memory.Resize(new_size);
-
+  
   for (int i = old_size; i < new_size; i++) {
     m_memory[i] = m_inst_set->GetRandomInst(ctx);
   }
@@ -1586,7 +1588,7 @@
   }
   if (allocated_size < 1) {
     organism->Fault(FAULT_LOC_ALLOC, FAULT_TYPE_ERROR,
-          cStringUtil::Stringf("Allocate of %d too small", allocated_size));
+                    cStringUtil::Stringf("Allocate of %d too small", allocated_size));
     return false;
   }
   
@@ -1596,25 +1598,25 @@
   // Make sure that the new size is in range.
   if (new_size > MAX_CREATURE_SIZE  ||  new_size < MIN_CREATURE_SIZE) {
     organism->Fault(FAULT_LOC_ALLOC, FAULT_TYPE_ERROR,
-          cStringUtil::Stringf("Invalid post-allocate size (%d)",
-                               new_size));
+                    cStringUtil::Stringf("Invalid post-allocate size (%d)",
+                                         new_size));
     return false;
   }
   
   const int max_alloc_size = (int) (old_size * m_world->GetConfig().CHILD_SIZE_RANGE.Get());
   if (allocated_size > max_alloc_size) {
     organism->Fault(FAULT_LOC_ALLOC, FAULT_TYPE_ERROR,
-          cStringUtil::Stringf("Allocate too large (%d > %d)",
-                               allocated_size, max_alloc_size));
+                    cStringUtil::Stringf("Allocate too large (%d > %d)",
+                                         allocated_size, max_alloc_size));
     return false;
   }
   
   const int max_old_size =
-    (int) (allocated_size * m_world->GetConfig().CHILD_SIZE_RANGE.Get());
+  (int) (allocated_size * m_world->GetConfig().CHILD_SIZE_RANGE.Get());
   if (old_size > max_old_size) {
     organism->Fault(FAULT_LOC_ALLOC, FAULT_TYPE_ERROR,
-          cStringUtil::Stringf("Allocate too small (%d > %d)",
-                               old_size, max_old_size));
+                    cStringUtil::Stringf("Allocate too small (%d > %d)",
+                                         old_size, max_old_size));
     return false;
   }
   
@@ -1622,16 +1624,16 @@
     case ALLOC_METHOD_NECRO:
       // Only break if this succeeds -- otherwise just do random.
       if (Allocate_Necro(new_size) == true) break;
-    case ALLOC_METHOD_RANDOM:
+      case ALLOC_METHOD_RANDOM:
       Allocate_Random(ctx, old_size, new_size);
       break;
-    case ALLOC_METHOD_DEFAULT:
+      case ALLOC_METHOD_DEFAULT:
       Allocate_Default(new_size);
       break;
   }
   
   m_mal_active = true;
-
+  
   return true;
 }
 
@@ -1646,7 +1648,7 @@
 
 
 bool cHardwareOrchid::Divide_Main(cAvidaContext& ctx, const int div_point,
-                               const int extra_lines, double mut_multiplier)
+                                  const int extra_lines, double mut_multiplier)
 {
   const int child_size = m_memory.GetSize() - div_point - extra_lines;
   
@@ -1664,7 +1666,7 @@
   
   // Handle Divide Mutations...
   Divide_DoMutations(ctx, mut_multiplier);
-
+  
   // Many tests will require us to run the offspring through a test CPU;
   // this is, for example, to see if mutations need to be reverted or if
   // lineages need to be updated.
@@ -1684,15 +1686,15 @@
   
   // Activate the child
   bool parent_alive = organism->ActivateDivide(ctx);
-
+  
   // Do more work if the parent lives through the birth of the offspring
   if (parent_alive) {
-  
+    
     if ( (m_world->GetConfig().EPIGENETIC_METHOD.Get() == EPIGENETIC_METHOD_PARENT) 
-    || (m_world->GetConfig().EPIGENETIC_METHOD.Get() == EPIGENETIC_METHOD_BOTH) ) {
+        || (m_world->GetConfig().EPIGENETIC_METHOD.Get() == EPIGENETIC_METHOD_BOTH) ) {
       InheritState(*this);  
     }
-
+    
     if (m_world->GetConfig().DIVIDE_METHOD.Get() == DIVIDE_METHOD_SPLIT) Reset();
   }
   
@@ -1700,16 +1702,16 @@
 }
 
 /*
-  Almost the same as Divide_Main, but resamples reverted offspring.
-
-  RESAMPLING ONLY WORKS CORRECTLY WHEN ALL MUTIONS OCCUR ON DIVIDE!!
-
-  AWC - 06/29/06
-*/
+ Almost the same as Divide_Main, but resamples reverted offspring.
+ 
+ RESAMPLING ONLY WORKS CORRECTLY WHEN ALL MUTIONS OCCUR ON DIVIDE!!
+ 
+ AWC - 06/29/06
+ */
 bool cHardwareOrchid::Divide_MainRS(cAvidaContext& ctx, const int div_point,
-                               const int extra_lines, double mut_multiplier)
+                                    const int extra_lines, double mut_multiplier)
 {
-
+  
   //cStats stats = m_world->GetStats();
   const int child_size = m_memory.GetSize() - div_point - extra_lines;
   
@@ -1726,22 +1728,22 @@
   m_memory.Resize(div_point);
   
   unsigned 
-    totalMutations = 0,
-    mutations = 0;
-    //RScount = 0;
-
-
+  totalMutations = 0,
+  mutations = 0;
+  //RScount = 0;
+  
+  
   bool
-    fitTest = false;
-
+  fitTest = false;
+  
   // Handle Divide Mutations...
   /*
-    Do mutations until one of these conditions are satisified:
-     we have resampled X times
-     we have an offspring with the same number of muations as the first offspring
-      that is not reverted
-     the parent is steralized (usually means an implicit mutation)
-  */
+   Do mutations until one of these conditions are satisified:
+   we have resampled X times
+   we have an offspring with the same number of muations as the first offspring
+   that is not reverted
+   the parent is steralized (usually means an implicit mutation)
+   */
   for(unsigned i = 0; i <= 100; i++){
     if(i == 0){
       mutations = totalMutations = Divide_DoMutations(ctx, mut_multiplier);
@@ -1750,23 +1752,23 @@
       mutations = Divide_DoMutations(ctx, mut_multiplier);
       m_world->GetStats().IncResamplings();
     }
-
+    
     fitTest = Divide_TestFitnessMeasures1(ctx);
     
     if(!fitTest && mutations >= totalMutations) break;
-
+    
   } 
   // think about making this mutations == totalMuations - though this may be too hard...
   /*
-  if(RScount > 2)
-    cerr << "Resampled " << RScount << endl;
-  */
+   if(RScount > 2)
+   cerr << "Resampled " << RScount << endl;
+   */
   //org could not be resampled beneath the hard cap -- it is then steraalized
   if(fitTest/*RScount == 11*/) {
     organism->GetPhenotype().ChildFertile() = false;
     m_world->GetStats().IncFailedResamplings();
   }
-
+  
 #if INSTRUCTION_COSTS
   // reset first time instruction costs
   for (int i = 0; i < inst_ft_cost.GetSize(); i++) {
@@ -1790,17 +1792,17 @@
 }
 
 /*
-  Almost the same as Divide_Main, but only allows for one mutation 
-    on divde and resamples reverted offspring.
-
-  RESAMPLING ONLY WORKS CORRECTLY WHEN ALL MUTIONS OCCUR ON DIVIDE!!
-
-  AWC - 07/28/06
-*/
+ Almost the same as Divide_Main, but only allows for one mutation 
+ on divde and resamples reverted offspring.
+ 
+ RESAMPLING ONLY WORKS CORRECTLY WHEN ALL MUTIONS OCCUR ON DIVIDE!!
+ 
+ AWC - 07/28/06
+ */
 bool cHardwareOrchid::Divide_Main1RS(cAvidaContext& ctx, const int div_point,
-                               const int extra_lines, double mut_multiplier)
+                                     const int extra_lines, double mut_multiplier)
 {
-
+  
   //cStats stats = m_world->GetStats();
   const int child_size = m_memory.GetSize() - div_point - extra_lines;
   
@@ -1817,22 +1819,22 @@
   m_memory.Resize(div_point);
   
   unsigned 
-    totalMutations = 0,
-    mutations = 0;
+  totalMutations = 0,
+  mutations = 0;
   //    RScount = 0;
-
+  
   bool
-    fitTest = false;
-
-
+  fitTest = false;
+  
+  
   // Handle Divide Mutations...
   /*
-    Do mutations until one of these conditions are satisified:
-     we have resampled X times
-     we have an offspring with the same number of muations as the first offspring
-      that is not reverted
-     the parent is steralized (usually means an implicit mutation)
-  */
+   Do mutations until one of these conditions are satisified:
+   we have resampled X times
+   we have an offspring with the same number of muations as the first offspring
+   that is not reverted
+   the parent is steralized (usually means an implicit mutation)
+   */
   for(unsigned i = 0; i < 100; i++){
     if(!i){
       mutations = totalMutations = Divide_DoMutations(ctx, mut_multiplier,1);
@@ -1841,23 +1843,23 @@
       mutations = Divide_DoExactMutations(ctx, mut_multiplier,1);
       m_world->GetStats().IncResamplings();
     }
-
+    
     fitTest = Divide_TestFitnessMeasures1(ctx);
     //if(mutations > 1 ) cerr << "Too Many mutations!!!!!!!!!!!!!!!" << endl;
     if(!fitTest && mutations >= totalMutations) break;
-
+    
   } 
   // think about making this mutations == totalMuations - though this may be too hard...
   /*
-  if(RScount > 2)
-    cerr << "Resampled " << RScount << endl;
-  */
+   if(RScount > 2)
+   cerr << "Resampled " << RScount << endl;
+   */
   //org could not be resampled beneath the hard cap -- it is then steraalized
   if(fitTest/*RScount == 11*/) {
     organism->GetPhenotype().ChildFertile() = false;
     m_world->GetStats().IncFailedResamplings();
   }
-
+  
 #if INSTRUCTION_COSTS
   // reset first time instruction costs
   for (int i = 0; i < inst_ft_cost.GetSize(); i++) {
@@ -1881,17 +1883,17 @@
 }
 
 /*
-  Almost the same as Divide_Main, but only allows for one mutation 
-    on divde and resamples reverted offspring.
-
-  RESAMPLING ONLY WORKS CORRECTLY WHEN ALL MUTIONS OCCUR ON DIVIDE!!
-
-  AWC - 07/28/06
-*/
+ Almost the same as Divide_Main, but only allows for one mutation 
+ on divde and resamples reverted offspring.
+ 
+ RESAMPLING ONLY WORKS CORRECTLY WHEN ALL MUTIONS OCCUR ON DIVIDE!!
+ 
+ AWC - 07/28/06
+ */
 bool cHardwareOrchid::Divide_Main2RS(cAvidaContext& ctx, const int div_point,
-                               const int extra_lines, double mut_multiplier)
+                                     const int extra_lines, double mut_multiplier)
 {
-
+  
   //cStats stats = m_world->GetStats();
   const int child_size = m_memory.GetSize() - div_point - extra_lines;
   
@@ -1908,22 +1910,22 @@
   m_memory.Resize(div_point);
   
   unsigned 
-    totalMutations = 0,
-    mutations = 0;
+  totalMutations = 0,
+  mutations = 0;
   //    RScount = 0;
-
+  
   bool
-    fitTest = false;
-
-
+  fitTest = false;
+  
+  
   // Handle Divide Mutations...
   /*
-    Do mutations until one of these conditions are satisified:
-     we have resampled X times
-     we have an offspring with the same number of muations as the first offspring
-      that is not reverted
-     the parent is steralized (usually means an implicit mutation)
-  */
+   Do mutations until one of these conditions are satisified:
+   we have resampled X times
+   we have an offspring with the same number of muations as the first offspring
+   that is not reverted
+   the parent is steralized (usually means an implicit mutation)
+   */
   for(unsigned i = 0; i < 100; i++){
     if(!i){
       mutations = totalMutations = Divide_DoMutations(ctx, mut_multiplier,2);
@@ -1932,23 +1934,23 @@
       Divide_DoExactMutations(ctx, mut_multiplier,mutations);
       m_world->GetStats().IncResamplings();
     }
-
+    
     fitTest = Divide_TestFitnessMeasures(ctx);
     //if(mutations > 1 ) cerr << "Too Many mutations!!!!!!!!!!!!!!!" << endl;
     if(!fitTest && mutations >= totalMutations) break;
-
+    
   } 
   // think about making this mutations == totalMuations - though this may be too hard...
   /*
-  if(RScount > 2)
-    cerr << "Resampled " << RScount << endl;
-  */
+   if(RScount > 2)
+   cerr << "Resampled " << RScount << endl;
+   */
   //org could not be resampled beneath the hard cap -- it is then steraalized
   if(fitTest/*RScount == 11*/) {
     organism->GetPhenotype().ChildFertile() = false;
     m_world->GetStats().IncFailedResamplings();
   }
-
+  
 #if INSTRUCTION_COSTS
   // reset first time instruction costs
   for (int i = 0; i < inst_ft_cost.GetSize(); i++) {
@@ -2191,10 +2193,10 @@
 {
   // Only initialize this once to save some time...
   static cInstruction catch_inst = GetInstSet().GetInst(cStringUtil::Stringf("catch"));
-
+  
   //Look for the label directly (no complement)
   ReadLabel();
-    
+  
   cHeadCPU search_head(IP());
   int start_pos = search_head.GetPosition();
   search_head++;
@@ -2206,7 +2208,7 @@
     {
       int catch_pos = search_head.GetPosition();
       search_head++;
-
+      
       // Continue to examine the label after the catch
       //  (1) It ends (=> use the catch!)
       //  (2) It becomes longer than the throw label (=> use the catch!)
@@ -2226,7 +2228,7 @@
       {
         IP().Set(catch_pos);
         m_advance_ip = false; // Don't automatically move the IP
-                              // so we mark the catch as executed.
+        // so we mark the catch as executed.
         return true;
       }
       
@@ -2235,7 +2237,7 @@
     }
     search_head.Advance();
   }
-
+  
   return false;
 }
 
@@ -2256,7 +2258,7 @@
 {
   // Only initialize this once to save some time...
   static cInstruction label_inst = GetInstSet().GetInst(cStringUtil::Stringf("label"));
-
+  
   //Look for an EXACT label match after a 'label' instruction
   ReadLabel();
   
@@ -2276,7 +2278,7 @@
         if ( !m_inst_set->IsNop(search_head.GetInst()) ) break;
         if ( GetLabel()[size_matched] != m_inst_set->GetNopMod( search_head.GetInst()) ) break;
         if ( !m_inst_set->IsNop(search_head.GetInst()) ) break;
-
+        
         size_matched++;
         search_head++;
       }
@@ -2287,16 +2289,16 @@
       {
         IP().Set(label_pos);
         m_advance_ip = false; // Don't automatically move the IP
-                              // so we mark the catch as executed.
+        // so we mark the catch as executed.
         return true;
       }
-
+      
       //If we advanced past NOPs during testing, retreat
       if ( !m_inst_set->IsNop(search_head.GetInst()) ) search_head--;
     }
     search_head++;
   }
-
+  
   return false;
 }
 
@@ -2672,17 +2674,17 @@
 {
   const int op1 = REG_BX;
   const int op2 = REG_AX;
-
+  
   const cHeadCPU from(this, GetRegister(op1));
   cHeadCPU to(this, GetRegister(op2) + GetRegister(op1));
-//  sCPUStats& cpu_stats = organism->CPUStats();
+  //  sCPUStats& cpu_stats = organism->CPUStats();
   
   if (organism->TestCopyMut(ctx)) {
     to.SetInst(m_inst_set->GetRandomInst(ctx));
     to.SetFlagMutated();  // Mark this instruction as mutated...
     to.SetFlagCopyMut();  // Mark this instruction as copy mut...
-                              //organism->GetPhenotype().IsMutated() = true;
-//    cpu_stats.mut_stats.copy_mut_count++;
+    //organism->GetPhenotype().IsMutated() = true;
+    //    cpu_stats.mut_stats.copy_mut_count++;
   } else {
     to.SetInst(from.GetInst());
     to.ClearFlagMutated();  // UnMark
@@ -2690,7 +2692,7 @@
   }
   
   to.SetFlagCopied();  // Set the copied flag.
-//  cpu_stats.mut_stats.copies_exec++;
+  //  cpu_stats.mut_stats.copies_exec++;
   return true;
 }
 
@@ -2698,7 +2700,7 @@
 {
   const int dst = FindModifiedRegister(REG_CX);
   const int src = REG_BX;
-
+  
   const cHeadCPU from(this, GetRegister(src));
   
   // Dis-allowing mutations on read, for the moment (write only...)
@@ -2712,26 +2714,26 @@
   const int src = FindModifiedRegister(REG_CX);
   const int op1 = REG_BX;
   const int op2 = REG_AX;
-
+  
   cHeadCPU to(this, GetRegister(op2) + GetRegister(op1));
   const int value = Mod(GetRegister(src), m_inst_set->GetSize());
-//  sCPUStats& cpu_stats = organism->CPUStats();
-
+  //  sCPUStats& cpu_stats = organism->CPUStats();
+  
   // Change value on a mutation...
   if (organism->TestCopyMut(ctx)) {
     to.SetInst(m_inst_set->GetRandomInst(ctx));
     to.SetFlagMutated();      // Mark this instruction as mutated...
     to.SetFlagCopyMut();      // Mark this instruction as copy mut...
-                                  //organism->GetPhenotype().IsMutated() = true;
-//    cpu_stats.mut_stats.copy_mut_count++;
+    //organism->GetPhenotype().IsMutated() = true;
+    //    cpu_stats.mut_stats.copy_mut_count++;
   } else {
     to.SetInst(cInstruction(value));
     to.ClearFlagMutated();     // UnMark
     to.ClearFlagCopyMut();     // UnMark
   }
-
+  
   to.SetFlagCopied();  // Set the copied flag.
-//  cpu_stats.mut_stats.copies_exec++;
+  //  cpu_stats.mut_stats.copies_exec++;
   return true;
 }
 
@@ -2749,15 +2751,15 @@
   const int op1 = REG_AX;
   cHeadCPU to(this, GetRegister(op1) + GetRegister(dst));
   const int value = Mod(StackPop(), m_inst_set->GetSize());
-//  sCPUStats& cpu_stats = organism->CPUStats();
+  //  sCPUStats& cpu_stats = organism->CPUStats();
   
   // Change value on a mutation...
   if (organism->TestCopyMut(ctx)) {
     to.SetInst(m_inst_set->GetRandomInst(ctx));
     to.SetFlagMutated();      // Mark this instruction as mutated...
     to.SetFlagCopyMut();      // Mark this instruction as copy mut...
-                                  //organism->GetPhenotype().IsMutated() = true;
-//    cpu_stats.mut_stats.copy_mut_count++;
+    //organism->GetPhenotype().IsMutated() = true;
+    //    cpu_stats.mut_stats.copy_mut_count++;
   } else {
     to.SetInst(cInstruction(value));
     to.ClearFlagMutated();     // UnMark
@@ -2765,7 +2767,7 @@
   }
   
   to.SetFlagCopied();  // Set the copied flag.
-//  cpu_stats.mut_stats.copies_exec++;
+  //  cpu_stats.mut_stats.copies_exec++;
   return true;
 }
 
@@ -2774,7 +2776,7 @@
   const int dst = FindModifiedRegister(REG_CX);
   const int op1 = REG_BX;
   const int op2 = REG_AX;
-
+  
   cHeadCPU from(this, GetRegister(op1));
   cHeadCPU to(this, GetRegister(op2) + GetRegister(op1));
   
@@ -2783,7 +2785,7 @@
     to.SetInst(m_inst_set->GetRandomInst(ctx));
     to.SetFlagMutated();      // Mark this instruction as mutated...
     to.SetFlagCopyMut();      // Mark this instruction as copy mut...
-                                  //organism->GetPhenotype().IsMutated() = true;
+    //organism->GetPhenotype().IsMutated() = true;
   }
   
   GetRegister(dst) = from.GetInst().GetOp() - to.GetInst().GetOp();
@@ -2795,7 +2797,7 @@
 {
   const int op1 = REG_BX;
   const int op2 = REG_AX;
-
+  
   const cHeadCPU from(this, GetRegister(op1));
   const cHeadCPU to(this, GetRegister(op2) + GetRegister(op1));
   
@@ -2826,11 +2828,11 @@
 }
 
 /*
-  Divide with resampling -- Same as regular divide but on reversions will be 
-  resampled after they are reverted.
-
-  AWC 06/29/06
-
+ Divide with resampling -- Same as regular divide but on reversions will be 
+ resampled after they are reverted.
+ 
+ AWC 06/29/06
+ 
  */
 
 bool cHardwareOrchid::Inst_DivideRS(cAvidaContext& ctx)  
@@ -2891,7 +2893,7 @@
   
   static cInstruction transposon_inst = GetInstSet().GetInst(cStringUtil::Stringf("transposon"));
   cCPUMemory& child_genome = organism->ChildGenome();
-
+  
   // Count the number of transposons that are marked as executed
   int tr_count = 0;
   for (int i=0; i < child_genome.GetSize(); i++) 
@@ -2909,19 +2911,19 @@
   }
   
   
-/*
-  const tArray<cCodeLabel> tr = organism->GetPhenotype().GetActiveTransposons();
-  cCPUMemory& child_genome = organism->ChildGenome();
-  
-  for (int i=0; i < tr.GetSize(); i++) 
-  {
-    if (ctx.GetRandom().P(0.1))
-    {
-      const unsigned int mut_line = ctx.GetRandom().GetUInt(child_genome.GetSize() + 1);
-      child_genome.Insert(mut_line, transposon_inst);
-    }
-  }
-*/  
+  /*
+   const tArray<cCodeLabel> tr = organism->GetPhenotype().GetActiveTransposons();
+   cCPUMemory& child_genome = organism->ChildGenome();
+   
+   for (int i=0; i < tr.GetSize(); i++) 
+   {
+   if (ctx.GetRandom().P(0.1))
+   {
+   const unsigned int mut_line = ctx.GetRandom().GetUInt(child_genome.GetSize() + 1);
+   child_genome.Insert(mut_line, transposon_inst);
+   }
+   }
+   */  
 }
 
 bool cHardwareOrchid::Inst_Repro(cAvidaContext& ctx)
@@ -2933,14 +2935,14 @@
   // check if repro can replace an existing organism
   if(m_world->GetConfig().REPRO_METHOD.Get() == 0 && organism->IsNeighborCellOccupied())
     return false;
-
+  
   if (organism->GetPhenotype().GetCurBonus() < m_world->GetConfig().REQUIRED_BONUS.Get()) return false;
   
   // Setup child
   cCPUMemory& child_genome = organism->ChildGenome();
   child_genome = m_memory;
   organism->GetPhenotype().SetLinesCopied(m_memory.GetSize());
-
+  
   int lines_executed = 0;
   for ( int i = 0; i < m_memory.GetSize(); i++ ) {
     if ( m_memory.FlagExecuted(i)) lines_executed++;
@@ -2999,7 +3001,7 @@
   
   const int reg_used = FindModifiedRegister(REG_BX);
   const int value = GetRegister(reg_used);
- // GetRegister(reg_used) = 0;
+  // GetRegister(reg_used) = 0;
   organism->DoOutput(ctx, value);
   
   // Immediately attempt a repro
@@ -3013,7 +3015,7 @@
   
   // Immediately attempt a repro
   Inst_Repro(ctx);
-
+  
   // return value of put since successful repro would wipe state anyway
   return return_value; 
 }
@@ -3032,7 +3034,7 @@
   return true;
 }
 
-                   
+
 bool cHardwareOrchid::Inst_Sterilize(cAvidaContext& ctx)
 {
   organism->GetPhenotype().IsFertile() = false;
@@ -3080,7 +3082,7 @@
     organism->Rotate(1);
   }  
   assert(organism->GetFacing() == orginalFacing);
-
+  
   for(int i = 0; i < organism->GetNeighborhoodSize(); i++) {
     if(organism->IsNeighborCellOccupied()) {
       // give energy testament to neighboring organisms
@@ -3097,7 +3099,7 @@
 bool cHardwareOrchid::Inst_RelinquishEnergyToOrganismsInDeme(cAvidaContext& ctx) {
   double stored_energy = organism->GetPhenotype().GetStoredEnergy() * m_world->GetConfig().FRAC_ENERGY_RELINQUISH.Get();
   // put stored energy into toBeApplied energy pool of neighbor organisms
-
+  
   organism->DivideOrgTestamentAmongDeme(stored_energy);
   m_world->GetStats().SumEnergyTestamentToDemeOrganisms().Add(stored_energy);
   organism->Die();
@@ -3242,8 +3244,8 @@
   // Randomize the inputs so they can't save numbers
   organism->GetOrgInterface().ResetInputs(ctx);   // Now re-randomize the inputs this organism sees
   organism->ClearInput();                         // Also clear their input buffers, or they can still claim
-                                                  // rewards for numbers no longer in their environment!
-
+  // rewards for numbers no longer in their environment!
+  
   const int reg_used_1 = FindModifiedRegister(REG_BX);
   const int reg_used_2 = FindNextRegister(reg_used_1);
   
@@ -3291,7 +3293,7 @@
   bool return_value = Inst_TaskPut(ctx);          // Do a normal put
   organism->GetOrgInterface().ResetInputs(ctx);   // Now re-randomize the inputs this organism sees
   organism->ClearInput();                         // Also clear their input buffers, or they can still claim
-                                                  // rewards for numbers no longer in their environment!
+  // rewards for numbers no longer in their environment!
   return return_value;
 }
 
@@ -3324,39 +3326,39 @@
 bool cHardwareOrchid::Inst_TaskIO_Feedback(cAvidaContext& ctx)
 {
   const int reg_used = FindModifiedRegister(REG_BX);
-
+  
   //check cur_bonus before the output
   double preOutputBonus = organism->GetPhenotype().GetCurBonus();
   
   // Do the "put" component
   const int value_out = GetRegister(reg_used);
   organism->DoOutput(ctx, value_out);  // Check for tasks completed.
-
+  
   //check cur_merit after the output
   double postOutputBonus = organism->GetPhenotype().GetCurBonus(); 
   
   
   //push the effect of the IO on merit (+,0,-) to the active stack
-
+  
   if (preOutputBonus > postOutputBonus){
     StackPush(-1);
-    }
+  }
   else if (preOutputBonus == postOutputBonus){
     StackPush(0);
-    }
+  }
   else if (preOutputBonus < postOutputBonus){
     StackPush(1);
-    }
+  }
   else {
     assert(0);
     //Bollocks. There was an error.
-    }
-
-
+  }
   
-
-
   
+  
+  
+  
+  
   // Do the "get" component
   const int value_in = organism->GetNextInput();
   GetRegister(reg_used) = value_in;
@@ -3425,14 +3427,14 @@
   // Returns the amount of a resource or resources 
   // specified by modifying NOPs into register BX
   const tArray<double> res_count = organism->GetOrgInterface().GetResources() + 
-    organism->GetOrgInterface().GetDemeResources(organism->GetOrgInterface().GetDemeID());
-
+  organism->GetOrgInterface().GetDemeResources(organism->GetOrgInterface().GetDemeID());
+  
   // Arbitrarily set to BX since the conditional instructions use this directly.
   int reg_to_set = REG_BX;
-
+  
   // There are no resources, return
   if (res_count.GetSize() == 0) return false;
-
+  
   // Only recalculate logs if these values have changed
   static int last_num_resources = 0;
   static int max_label_length = 0;
@@ -3440,16 +3442,16 @@
   
   if ((last_num_resources != res_count.GetSize()))
   {
-      max_label_length = (int) ceil(log((double)res_count.GetSize())/log((double)num_nops));
-      last_num_resources = res_count.GetSize();
+    max_label_length = (int) ceil(log((double)res_count.GetSize())/log((double)num_nops));
+    last_num_resources = res_count.GetSize();
   }
-
+  
   // Convert modifying NOPs to the index of the resource.
   // If there are fewer than the number of NOPs required
   // to uniquely specify a resource, then add together
   // a subset of resources (motivation: regulation can evolve
   // to be more specific if there is an advantage)
-   
+  
   // Find the maximum number of NOPs needed to specify this number of resources
   // Note: It's a bit wasteful to recalculate this every time and organisms will
   // definitely be confused if the number of resources changes during a run
@@ -3474,11 +3476,11 @@
   
   int start_index = start_label.AsInt(num_nops);
   int   end_index =   end_label.AsInt(num_nops);
-
+  
   // If the label refers to ONLY resources that 
   // do not exist, then the operation fails
   if (start_index >= res_count.GetSize()) return false;
-
+  
   // Otherwise sum all valid resources that it might refer to
   // (this will only be ONE if the label was of the maximum length).
   int resource_result = 0;
@@ -3515,7 +3517,7 @@
       resource_result = (int)(log(dresource_result)/log(base));
     }
   }
-    
+  
   //Dump this value into an arbitrary register: BX
   GetRegister(reg_to_set) = resource_result;
   
@@ -3531,21 +3533,21 @@
   organism->GetPhenotype().IncSenseCount(sensed_index);
   
   return true; 
-
+  
   // Note that we are converting <double> resources to <int> register values
 }
 
 
 /*! Sense the level of resources in this organism's cell, and if all of the 
-resources present are above the min level for that resource, execute the following
-intruction.  Otherwise, skip the following instruction.
-*/
+ resources present are above the min level for that resource, execute the following
+ intruction.  Otherwise, skip the following instruction.
+ */
 bool cHardwareOrchid::Inst_IfResources(cAvidaContext& ctx)
 {
   // These are the current levels of resources at this cell:
   const tArray<double> resources = organism->GetOrgInterface().GetResources() + 
-    organism->GetOrgInterface().GetDemeResources(organism->GetOrgInterface().GetDemeID());
-
+  organism->GetOrgInterface().GetDemeResources(organism->GetOrgInterface().GetDemeID());
+  
   // Now we loop through the different reactions, checking to see if their
   // required resources are below what's available.  If so, we skip ahead an
   // instruction and return.
@@ -3576,7 +3578,7 @@
   // Fail if we're running in the test CPU.
   if((organism->GetOrgInterface().GetDemeID() < 0) || (organism->GetCellID() < 0))
     return false;
-
+  
   const int reg = FindModifiedRegister(REG_BX);
   int eventID = organism->GetCellData();
   GetRegister(reg) = organism->GetOrgInterface().GetDeme()->KillCellEvent(eventID);
@@ -3587,7 +3589,7 @@
   // Fail if we're running in the test CPU.
   if((organism->GetOrgInterface().GetDemeID() < 0) || (organism->GetCellID() < 0))
     return false;
-
+  
   const int reg = FindModifiedRegister(REG_BX);
   int eventID = organism->GetNeighborCellContents();
   GetRegister(reg) = organism->GetOrgInterface().GetDeme()->KillCellEvent(eventID);
@@ -3614,14 +3616,14 @@
 void cHardwareOrchid::DoDonate(cOrganism* to_org)
 {
   assert(to_org != NULL);
-
+  
   const double merit_given = m_world->GetConfig().MERIT_GIVEN.Get();
   const double merit_received = m_world->GetConfig().MERIT_RECEIVED.Get();
-
+  
   double cur_merit = organism->GetPhenotype().GetMerit().GetDouble();
   cur_merit -= merit_given;
   if(cur_merit < 0) cur_merit=0; 
-
+  
   // Plug the current merit back into this organism and notify the scheduler.
   organism->UpdateMerit(cur_merit);
   
@@ -3634,9 +3636,9 @@
 void cHardwareOrchid::DoEnergyDonate(cOrganism* to_org)
 {
   assert(to_org != NULL);
-
+  
   const double frac_energy_given = m_world->GetConfig().MERIT_GIVEN.Get();
-
+  
   double cur_energy = organism->GetPhenotype().GetStoredEnergy();
   double energy_given = cur_energy * frac_energy_given;
   
@@ -3657,7 +3659,7 @@
   }
   organism->GetPhenotype().IncDonates();
   organism->GetPhenotype().SetIsDonorRand();
-
+  
   // Get faced neighbor
   cOrganism * neighbor = organism->GetNeighbor();
   
@@ -3676,10 +3678,10 @@
   if (organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) {
     return false;
   }
-
+  
   organism->GetPhenotype().IncDonates();
   organism->GetPhenotype().SetIsDonorRand();
-
+  
   // Turn to a random neighbor, get it, and turn back...
   int neighbor_id = ctx.GetRandom().GetInt(organism->GetNeighborhoodSize());
   for (int i = 0; i < neighbor_id; i++) organism->Rotate(1);
@@ -3692,16 +3694,16 @@
     
     //print out how often random donations go to kin
     /*
-    static ofstream kinDistanceFile("kinDistance.dat");
-    kinDistanceFile << (genotype->GetPhyloDistance(neighbor->GetGenotype())<=1) << " ";
-    kinDistanceFile << (genotype->GetPhyloDistance(neighbor->GetGenotype())<=2) << " ";
-    kinDistanceFile << (genotype->GetPhyloDistance(neighbor->GetGenotype())<=3) << " ";
-    kinDistanceFile << genotype->GetPhyloDistance(neighbor->GetGenotype());
-    kinDistanceFile << endl; 
-    */
+     static ofstream kinDistanceFile("kinDistance.dat");
+     kinDistanceFile << (genotype->GetPhyloDistance(neighbor->GetGenotype())<=1) << " ";
+     kinDistanceFile << (genotype->GetPhyloDistance(neighbor->GetGenotype())<=2) << " ";
+     kinDistanceFile << (genotype->GetPhyloDistance(neighbor->GetGenotype())<=3) << " ";
+     kinDistanceFile << genotype->GetPhyloDistance(neighbor->GetGenotype());
+     kinDistanceFile << endl; 
+     */
     neighbor->GetPhenotype().SetIsReceiverRand();
   }
-
+  
   return true;
 }
 
@@ -3714,8 +3716,8 @@
   
   organism->GetPhenotype().IncDonates();
   organism->GetPhenotype().SetIsDonorKin();
-
-
+  
+  
   // Find the target as the first Kin found in the neighborhood.
   const int num_neighbors = organism->GetNeighborhoodSize();
   
@@ -3759,7 +3761,7 @@
   if (organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) {
     return false;
   }
-
+  
   organism->GetPhenotype().IncDonates();
   organism->GetPhenotype().SetIsDonorEdit();
   
@@ -3810,63 +3812,63 @@
   //in their genome (see Dawkins 1976, The Selfish Gene, for 
   //the history of the theory and the name 'green beard'
   cPhenotype & phenotype = organism->GetPhenotype();
-
+  
   if (organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) {
     return false;
   }
-
+  
   phenotype.IncDonates();
   phenotype.SetIsDonorGbg();
-
+  
   // Find the target as the first match found in the neighborhood.
-
+  
   //get the neighborhood size
   const int num_neighbors = organism->GetNeighborhoodSize();
-
+  
   // Turn to face a random neighbor
   int neighbor_id = ctx.GetRandom().GetInt(num_neighbors);
   for (int i = 0; i < neighbor_id; i++) organism->Rotate(1);
   cOrganism * neighbor = organism->GetNeighbor();
-
+  
   int max_id = neighbor_id + num_neighbors;
- 
+  
   //we have not found a match yet
   bool found = false;
-
+  
   // rotate through orgs in neighborhood  
   while (neighbor_id < max_id) {
-      neighbor = organism->GetNeighbor();
-
-      //if neighbor exists, do they have the green beard gene?
-      if (neighbor != NULL) {
-          const cGenome & neighbor_genome = neighbor->GetGenome();
-
-          // for each instruction in the genome...
-          for(int i=0;i<neighbor_genome.GetSize();i++){
-
-            // ...see if it is donate-gbg
-            if (neighbor_genome[i] == IP().GetInst()) {
-              found = true;
-              break;
-            }
-	    
-          }
+    neighbor = organism->GetNeighbor();
+    
+    //if neighbor exists, do they have the green beard gene?
+    if (neighbor != NULL) {
+      const cGenome & neighbor_genome = neighbor->GetGenome();
+      
+      // for each instruction in the genome...
+      for(int i=0;i<neighbor_genome.GetSize();i++){
+        
+        // ...see if it is donate-gbg
+        if (neighbor_genome[i] == IP().GetInst()) {
+          found = true;
+          break;
+        }
+        
       }
-      
-      // stop searching through the neighbors if we already found one
-      if (found == true);{
+    }
+    
+    // stop searching through the neighbors if we already found one
+    if (found == true);{
     	break;
-      }
+    }
+    
+    organism->Rotate(1);
+    neighbor_id++;
+  }
   
-      organism->Rotate(1);
-      neighbor_id++;
-  }
-
-    if (found == false) neighbor = NULL;
-
+  if (found == false) neighbor = NULL;
+  
   // Put the facing back where it was.
   for (int i = 0; i < neighbor_id; i++) organism->Rotate(-1);
-
+  
   // Donate only if we have found a close enough relative...
   if (neighbor != NULL) {
     DoDonate(neighbor);
@@ -3885,69 +3887,69 @@
   //the history of the theory and the name 'green beard'
   //  cout << "i am about to donate to a green beard" << endl;
   cPhenotype & phenotype = organism->GetPhenotype();
-
+  
   if (organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) {
     return false;
   }
-
+  
   phenotype.IncDonates();
   phenotype.SetIsDonorTrueGb();
-
+  
   // Find the target as the first match found in the neighborhood.
-
+  
   //get the neighborhood size
   const int num_neighbors = organism->GetNeighborhoodSize();
-
+  
   // Turn to face a random neighbor
   int neighbor_id = ctx.GetRandom().GetInt(num_neighbors);
   for (int i = 0; i < neighbor_id; i++) organism->Rotate(1);
   cOrganism * neighbor = organism->GetNeighbor();
-
+  
   int max_id = neighbor_id + num_neighbors;
- 
+  
   //we have not found a match yet
   bool found = false;
-
+  
   // rotate through orgs in neighborhood  
   while (neighbor_id < max_id) {
-      neighbor = organism->GetNeighbor();
-      //if neighbor exists, AND if their parent attempted to donate,
-      if (neighbor != NULL && neighbor->GetPhenotype().IsDonorTrueGbLast()) {
-          const cGenome & neighbor_genome = neighbor->GetGenome();
-
-          // for each instruction in the genome...
-          for(int i=0;i<neighbor_genome.GetSize();i++){
-
-            // ...see if it is donate-tgb, if so, we found a target
-            if (neighbor_genome[i] == IP().GetInst()) {
-              found = true;
-              break;
-            }
-	    
-          }
+    neighbor = organism->GetNeighbor();
+    //if neighbor exists, AND if their parent attempted to donate,
+    if (neighbor != NULL && neighbor->GetPhenotype().IsDonorTrueGbLast()) {
+      const cGenome & neighbor_genome = neighbor->GetGenome();
+      
+      // for each instruction in the genome...
+      for(int i=0;i<neighbor_genome.GetSize();i++){
+        
+        // ...see if it is donate-tgb, if so, we found a target
+        if (neighbor_genome[i] == IP().GetInst()) {
+          found = true;
+          break;
+        }
+        
       }
-      
-      // stop searching through the neighbors if we already found one
-      if (found == true);{
+    }
+    
+    // stop searching through the neighbors if we already found one
+    if (found == true);{
     	break;
-      }
+    }
+    
+    organism->Rotate(1);
+    neighbor_id++;
+  }
   
-      organism->Rotate(1);
-      neighbor_id++;
-  }
-
-    if (found == false) neighbor = NULL;
-
+  if (found == false) neighbor = NULL;
+  
   // Put the facing back where it was.
   for (int i = 0; i < neighbor_id; i++) organism->Rotate(-1);
-
+  
   // Donate only if we have found a close enough relative...
   if (neighbor != NULL) {
     DoDonate(neighbor);
     neighbor->GetPhenotype().SetIsReceiverTrueGb();
   }
-
   
+  
   return true;
   
 }
@@ -3960,64 +3962,64 @@
   //the history of the theory and the name 'green beard'
   //  cout << "i am about to donate to a green beard" << endl;
   cPhenotype & phenotype = organism->GetPhenotype();
-
+  
   if (organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) {
     return false;
   }
-
-
+  
+  
   phenotype.IncDonates();
   phenotype.SetIsDonorThreshGb();
   phenotype.IncNumThreshGbDonations();
-
+  
   // Find the target as the first match found in the neighborhood.
-
+  
   //get the neighborhood size
   const int num_neighbors = organism->GetNeighborhoodSize();
-
+  
   // Turn to face a random neighbor
   int neighbor_id = ctx.GetRandom().GetInt(num_neighbors);
   for (int i = 0; i < neighbor_id; i++) organism->Rotate(1);
   cOrganism * neighbor = organism->GetNeighbor();
-
+  
   int max_id = neighbor_id + num_neighbors;
- 
+  
   //we have not found a match yet
   bool found = false;
-
+  
   // rotate through orgs in neighborhood  
   while (neighbor_id < max_id) {
-      neighbor = organism->GetNeighbor();
-      //if neighbor exists, AND if their parent attempted to donate >= threshhold,
-      if (neighbor != NULL && neighbor->GetPhenotype().GetNumThreshGbDonationsLast()>= m_world->GetConfig().MIN_GB_DONATE_THRESHOLD.Get() ) {
-          const cGenome & neighbor_genome = neighbor->GetGenome();
-
-          // for each instruction in the genome...
-          for(int i=0;i<neighbor_genome.GetSize();i++){
-
-	         // ...see if it is donate-threshgb, if so, we found a target
-            if (neighbor_genome[i] == IP().GetInst()) {
-              found = true;
-              break;
-            }
-	    
-          }
+    neighbor = organism->GetNeighbor();
+    //if neighbor exists, AND if their parent attempted to donate >= threshhold,
+    if (neighbor != NULL && neighbor->GetPhenotype().GetNumThreshGbDonationsLast()>= m_world->GetConfig().MIN_GB_DONATE_THRESHOLD.Get() ) {
+      const cGenome & neighbor_genome = neighbor->GetGenome();
+      
+      // for each instruction in the genome...
+      for(int i=0;i<neighbor_genome.GetSize();i++){
+        
+        // ...see if it is donate-threshgb, if so, we found a target
+        if (neighbor_genome[i] == IP().GetInst()) {
+          found = true;
+          break;
+        }
+        
       }
-      
-      // stop searching through the neighbors if we already found one
-      if (found == true);{
+    }
+    
+    // stop searching through the neighbors if we already found one
+    if (found == true);{
     	break;
-      }
+    }
+    
+    organism->Rotate(1);
+    neighbor_id++;
+  }
   
-      organism->Rotate(1);
-      neighbor_id++;
-  }
-
-    if (found == false) neighbor = NULL;
-
+  if (found == false) neighbor = NULL;
+  
   // Put the facing back where it was.
   for (int i = 0; i < neighbor_id; i++) organism->Rotate(-1);
-
+  
   // Donate only if we have found a close enough relative...
   if (neighbor != NULL) {
     DoDonate(neighbor);
@@ -4025,7 +4027,7 @@
     // cout << "************ neighbor->GetPhenotype().GetNumThreshGbDonationsLast() is " << neighbor->GetPhenotype().GetNumThreshGbDonationsLast() << endl;
     
   }
-
+  
   return true;
   
 }
@@ -4040,81 +4042,81 @@
   // using this instruction.  The threshold levels are multiples of
   // the quanta value set in genesis, and the highest level that
   // the donor qualifies for is the one used.
-
+  
   // (see Dawkins 1976, The Selfish Gene, for 
   // the history of the theory and the name 'green beard'
   //  cout << "i am about to donate to a green beard" << endl;
   cPhenotype & phenotype = organism->GetPhenotype();
-
+  
   if (phenotype.GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) {
     return false;
   }
-
+  
   phenotype.IncDonates();
   phenotype.SetIsDonorQuantaThreshGb();
   phenotype.IncNumQuantaThreshGbDonations();
   //cout << endl << "quanta_threshgb attempt.. " ;
-
-
+  
+  
   // Find the target as the first match found in the neighborhood.
-
+  
   //get the neighborhood size
   const int num_neighbors = organism->GetNeighborhoodSize();
-
+  
   // Turn to face a random neighbor
   int neighbor_id = ctx.GetRandom().GetInt(num_neighbors);
   for (int i = 0; i < neighbor_id; i++) organism->Rotate(1);
   cOrganism * neighbor = organism->GetNeighbor();
-
+  
   int max_id = neighbor_id + num_neighbors;
- 
+  
   //we have not found a match yet
   bool found = false;
-
+  
   // Get the quanta (step size) between threshold levels.
   const int donate_quanta = m_world->GetConfig().DONATE_THRESH_QUANTA.Get();
   
   // Calculate what quanta level we should be at for this individual.  We do a
   // math trick to make sure its the next lowest event multiple of donate_quanta.
   const int quanta_donate_thresh =
-    (phenotype.GetNumQuantaThreshGbDonationsLast() / donate_quanta) * donate_quanta;
+  (phenotype.GetNumQuantaThreshGbDonationsLast() / donate_quanta) * donate_quanta;
   //cout << " phenotype.GetNumQuantaThreshGbDonationsLast() is " << phenotype.GetNumQuantaThreshGbDonationsLast();
   //cout << " quanta thresh=  " << quanta_donate_thresh;
   // rotate through orgs in neighborhood  
   while (neighbor_id < max_id) {
-      neighbor = organism->GetNeighbor();
-      //if neighbor exists, AND if their parent attempted to donate >= threshhold,
-      if (neighbor != NULL &&
-	  neighbor->GetPhenotype().GetNumQuantaThreshGbDonationsLast() >= quanta_donate_thresh) {
-
-          const cGenome & neighbor_genome = neighbor->GetGenome();
-
-          // for each instruction in the genome...
-          for(int i=0;i<neighbor_genome.GetSize();i++){
-
-	         // ...see if it is donate-quantagb, if so, we found a target
-            if (neighbor_genome[i] == IP().GetInst()) {
-              found = true;
-              break;
-            }
-	    
-          }
+    neighbor = organism->GetNeighbor();
+    //if neighbor exists, AND if their parent attempted to donate >= threshhold,
+    if (neighbor != NULL &&
+        neighbor->GetPhenotype().GetNumQuantaThreshGbDonationsLast() >= quanta_donate_thresh) {
+      
+      const cGenome & neighbor_genome = neighbor->GetGenome();
+      
+      // for each instruction in the genome...
+      for(int i=0;i<neighbor_genome.GetSize();i++){
+        
+        // ...see if it is donate-quantagb, if so, we found a target
+        if (neighbor_genome[i] == IP().GetInst()) {
+          found = true;
+          break;
+        }
+        
       }
-      
-      // stop searching through the neighbors if we already found one
-      if (found == true);{
+    }
+    
+    // stop searching through the neighbors if we already found one
+    if (found == true);{
     	break;
-      }
+    }
+    
+    organism->Rotate(1);
+    neighbor_id++;
+  }
   
-      organism->Rotate(1);
-      neighbor_id++;
-  }
-
-    if (found == false) neighbor = NULL;
-
+  if (found == false) neighbor = NULL;
+  
   // Put the facing back where it was.
   for (int i = 0; i < neighbor_id; i++) organism->Rotate(-1);
-
+  
   // Donate only if we have found a close enough relative...
   if (neighbor != NULL) {
     DoDonate(neighbor);
@@ -4122,7 +4124,7 @@
     //cout << " ************ neighbor->GetPhenotype().GetNumQuantaThreshGbDonationsLast() is " << neighbor->GetPhenotype().GetNumQuantaThreshGbDonationsLast();
     
   }
-
+  
   return true;
   
 }
@@ -4133,7 +4135,7 @@
   if (organism->GetPhenotype().GetCurNumDonates() > m_world->GetConfig().MAX_DONATES.Get()) {
     return false;
   }
-
+  
   organism->GetPhenotype().IncDonates();
   organism->GetPhenotype().SetIsDonorNull();
   
@@ -4257,8 +4259,8 @@
 }
 
 /**
-  Rotate to facing specified by following label
-*/
+ Rotate to facing specified by following label
+ */
 bool cHardwareOrchid::Inst_RotateLabel(cAvidaContext& ctx)
 {
   int standardNeighborhoodSize, actualNeighborhoodSize, newFacing, currentFacing;
@@ -4362,7 +4364,7 @@
   // tumblelog.open("data/tumblelog.txt",ios::app);
   // tumblelog << organism->GetID() << "," << irot << endl;
   // tumblelog.close();
-
+  
   return true;
 }
 
@@ -4374,7 +4376,7 @@
 {
   // Declarations
   int fromcellID, destcellID; //, actualNeighborhoodSize, fromFacing, destFacing, currentFacing;
-
+  
   // Get population
   cPopulation& pop = m_world->GetPopulation();
   cDeme &deme = pop.GetDeme(pop.GetCell(organism->GetCellID()).GetDemeID());
@@ -4382,11 +4384,11 @@
   // Get stepsize. Currently, all moves are one cell regardless of stepsize.
   // This could be changed in the future.
   const int stepsize = m_world->GetConfig().BIOMIMETIC_MOVEMENT_STEP.Get();
-
+  
   // Pheromone stuff
   double pher_amount = 0;
   int drop_mode = -1;
-
+  
   // Code
   if (0 < stepsize) {
     // Current cell
@@ -4414,51 +4416,51 @@
     
     // updates movement predicates
     m_world->GetStats().Move(*organism);
-
+    
     // If organism is dropping pheromones, mark the appropriate cell(s)
     if( (m_world->GetConfig().PHEROMONE_ENABLED.Get() == 1) &&
-        (organism->GetPheromoneStatus() == true) ) {
-
-        pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
-	drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
-	
-	if(drop_mode == 0) {
-          deme.AddPheromone(fromcellID, pher_amount/2);
-          deme.AddPheromone(destcellID, pher_amount/2);
-	} else if(drop_mode == 1) {
-          deme.AddPheromone(fromcellID, pher_amount);
-	}
-	else if(drop_mode == 2) {
-          deme.AddPheromone(destcellID, pher_amount);
-	}
-
-       // Old CellData-based version
-       //const int newval = pop.GetCell(destcellID).GetCellData() + 1;
-       //pop.GetCell(destcellID).SetCellData(newval);
-
+       (organism->GetPheromoneStatus() == true) ) {
+      
+      pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
+      drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
+      
+      if(drop_mode == 0) {
+        deme.AddPheromone(fromcellID, pher_amount/2);
+        deme.AddPheromone(destcellID, pher_amount/2);
+      } else if(drop_mode == 1) {
+        deme.AddPheromone(fromcellID, pher_amount);
+      }
+      else if(drop_mode == 2) {
+        deme.AddPheromone(destcellID, pher_amount);
+      }
+      
+      // Old CellData-based version
+      //const int newval = pop.GetCell(destcellID).GetCellData() + 1;
+      //pop.GetCell(destcellID).SetCellData(newval);
+      
     } //End laying pheromone
-
+    
     // Write some logging information if LOG_PHEROMONE is set.  This is done
     // out here so that non-pheromone moves are recorded.
     if( (m_world->GetConfig().LOG_PHEROMONE.Get() == 1) &&
-        (m_world->GetStats().GetUpdate() >= m_world->GetConfig().MOVETARGET_LOG_START.Get()) ) {
+       (m_world->GetStats().GetUpdate() >= m_world->GetConfig().MOVETARGET_LOG_START.Get()) ) {
       cString tmpfilename = cStringUtil::Stringf("movelog.dat");
       cDataFile& df = m_world->GetDataFile(tmpfilename);
-
+      
       int rel_srcid = deme.GetRelativeCellID(fromcellID);
       int rel_destid = deme.GetRelativeCellID(destcellID);
-
+      
       cString UpdateStr = cStringUtil::Stringf("%d,%d,%d,%d,%d,%f,%d,5",  m_world->GetStats().GetUpdate(), organism->GetID(), deme.GetDemeID(), rel_srcid, rel_destid, pher_amount, drop_mode);
       df.WriteRaw(UpdateStr);
     }
-
-
+    
+    
     // check tasks.  general movement tasks are not yet supported.
     //organism->DoOutput(ctx);
-
+    
     // Brian movement
     organism->Move(ctx);
-
+    
     return true;
   } else {
     return false;
@@ -4499,7 +4501,7 @@
 
 bool cHardwareOrchid::Inst_IfFacingEventCell(cAvidaContext& ctx) {
   if(organism->GetNeighborCellContents() > 0) { 
-      return true;
+    return true;
   }
   IP().Advance();
   return true;
@@ -4507,7 +4509,7 @@
 
 bool cHardwareOrchid::Inst_IfEventInCell(cAvidaContext& ctx) {
   if(organism->GetCellData() > 0) { 
-      return true;
+    return true;
   }
   IP().Advance();
   return true;
@@ -4662,8 +4664,8 @@
 }
 
 /*
-  Resample Divide -- AWC 06/29/06
-*/
+ Resample Divide -- AWC 06/29/06
+ */
 
 bool cHardwareOrchid::Inst_HeadDivideRS(cAvidaContext& ctx)
 {
@@ -4679,8 +4681,8 @@
 }
 
 /*
-  Resample Divide -- single mut on divide-- AWC 07/28/06
-*/
+ Resample Divide -- single mut on divide-- AWC 07/28/06
+ */
 
 bool cHardwareOrchid::Inst_HeadDivide1RS(cAvidaContext& ctx)
 {
@@ -4696,8 +4698,8 @@
 }
 
 /*
-  Resample Divide -- double mut on divide-- AWC 08/29/06
-*/
+ Resample Divide -- double mut on divide-- AWC 08/29/06
+ */
 
 bool cHardwareOrchid::Inst_HeadDivide2RS(cAvidaContext& ctx)
 {
@@ -4778,20 +4780,20 @@
   
   const int head_id = FindModifiedHead(nHardware::HEAD_READ);
   GetHead(head_id).Adjust();
-//  sCPUStats & cpu_stats = organism->CPUStats();
+  //  sCPUStats & cpu_stats = organism->CPUStats();
   
   // Mutations only occur on the read, for the moment.
   int read_inst = 0;
   if (organism->TestCopyMut(ctx)) {
     read_inst = m_inst_set->GetRandomInst(ctx).GetOp();
-//    cpu_stats.mut_stats.copy_mut_count++;  // @CAO, hope this is good!
+    //    cpu_stats.mut_stats.copy_mut_count++;  // @CAO, hope this is good!
   } else {
     read_inst = GetHead(head_id).GetInst().GetOp();
   }
   GetRegister(dst) = read_inst;
   ReadInst(read_inst);
   
-//  cpu_stats.mut_stats.copies_exec++;  // @CAO, this too..
+  //  cpu_stats.mut_stats.copies_exec++;  // @CAO, this too..
   GetHead(head_id).Advance();
   return true;
 }
@@ -4820,7 +4822,7 @@
   // For the moment, this cannot be nop-modified.
   cHeadCPU& read_head = GetHead(nHardware::HEAD_READ);
   cHeadCPU& write_head = GetHead(nHardware::HEAD_WRITE);
-//  sCPUStats& cpu_stats = organism->CPUStats();
+  //  sCPUStats& cpu_stats = organism->CPUStats();
   
   read_head.Adjust();
   write_head.Adjust();
@@ -4830,12 +4832,12 @@
   ReadInst(read_inst.GetOp());
   if (organism->TestCopyMut(ctx)) {
     read_inst = m_inst_set->GetRandomInst(ctx);
-//    cpu_stats.mut_stats.copy_mut_count++; 
+    //    cpu_stats.mut_stats.copy_mut_count++; 
     write_head.SetFlagMutated();
     write_head.SetFlagCopyMut();
   }
   
-//  cpu_stats.mut_stats.copies_exec++;
+  //  cpu_stats.mut_stats.copies_exec++;
   write_head.SetInst(read_inst);
   write_head.SetFlagCopied();  // Set the copied flag...
   
@@ -4843,7 +4845,7 @@
   write_head.Advance();
   
   //Slip mutations
-   if (organism->TestCopySlip(ctx)) {
+  if (organism->TestCopySlip(ctx)) {
     read_head.Set(ctx.GetRandom().GetInt(organism->GetGenome().GetSize()));
   }
   
@@ -4855,7 +4857,7 @@
   // For the moment, this cannot be nop-modified.
   cHeadCPU & read_head = GetHead(nHardware::HEAD_READ);
   cHeadCPU & write_head = GetHead(nHardware::HEAD_WRITE);
-//  sCPUStats & cpu_stats = organism->CPUStats();
+  //  sCPUStats & cpu_stats = organism->CPUStats();
   
   read_head.Adjust();
   write_head.Adjust();
@@ -4865,13 +4867,13 @@
   ReadInst(read_inst.GetOp());
   if ( ctx.GetRandom().P(organism->GetCopyMutProb() / reduction) ) {
     read_inst = m_inst_set->GetRandomInst(ctx);
-//    cpu_stats.mut_stats.copy_mut_count++; 
+    //    cpu_stats.mut_stats.copy_mut_count++; 
     write_head.SetFlagMutated();
     write_head.SetFlagCopyMut();
     //organism->GetPhenotype().IsMutated() = true;
   }
   
-//  cpu_stats.mut_stats.copies_exec++;
+  //  cpu_stats.mut_stats.copies_exec++;
   
   write_head.SetInst(read_inst);
   write_head.SetFlagCopied();  // Set the copied flag...
@@ -4916,7 +4918,7 @@
   int cellID = organism->GetCellID();
   // Fail if we're running in the test CPU.
   if(cellID < 0) return false;
-
+  
   if(m_world->GetConfig().LOG_SLEEP_TIMES.Get() == 1) {
     pop.AddEndSleep(cellID, m_world->GetStats().GetUpdate());
   }
@@ -4939,10 +4941,10 @@
 
 
 /*! This method places the calling organism's x-y coordinates in ?BX? and ?++BX?.
-
-Note that this method *will not work* from within the test CPU, so we have to guard
-against that.
-*/
+ 
+ Note that this method *will not work* from within the test CPU, so we have to guard
+ against that.
+ */
 bool cHardwareOrchid::Inst_GetCellPosition(cAvidaContext& ctx) {
   int absolute_cell_ID = organism->GetCellID();
   int deme_id = organism->GetOrgInterface().GetDemeID();
@@ -4958,10 +4960,10 @@
 }
 
 /*! This method places the calling organism's x coordinate in ?BX?.
-
-Note that this method *will not work* from within the test CPU, so we have to guard
-against that.
-*/
+ 
+ Note that this method *will not work* from within the test CPU, so we have to guard
+ against that.
+ */
 bool cHardwareOrchid::Inst_GetCellPositionX(cAvidaContext& ctx) {
   int absolute_cell_ID = organism->GetCellID();
   int deme_id = organism->GetOrgInterface().GetDemeID();
@@ -4975,10 +4977,10 @@
 }
 
 /*! This method places the calling organism's y coordinates in ?BX?.
-
-Note that this method *will not work* from within the test CPU, so we have to guard
-against that.
-*/
+ 
+ Note that this method *will not work* from within the test CPU, so we have to guard
+ against that.
+ */
 bool cHardwareOrchid::Inst_GetCellPositionY(cAvidaContext& ctx) {
   int absolute_cell_ID = organism->GetCellID();
   int deme_id = organism->GetOrgInterface().GetDemeID();
@@ -5005,7 +5007,7 @@
   } else {
     GetRegister(reg) = (int)floor((pos.first - pos.second)/2.0);
   }
-//  std::cerr<<"x = "<<pos.first<<"  y = "<<pos.second<<"  ans = "<<GetRegister(reg)<<std::endl;
+  //  std::cerr<<"x = "<<pos.first<<"  y = "<<pos.second<<"  ans = "<<GetRegister(reg)<<std::endl;
   return true;
 }
 
@@ -5033,14 +5035,14 @@
     //Setting this makes it harder to do things. You have to be modular.
     organism->GetOrgInterface().ResetInputs(ctx);   // Re-randomize the inputs this organism sees
     organism->ClearInput();                         // Also clear their input buffers, or they can still claim
-                                                    // rewards for numbers no longer in their environment!
+    // rewards for numbers no longer in their environment!
   }
   
   // Reset our count
   m_threads[m_cur_thread].ResetPromoterInstExecuted();
   m_advance_ip = false;
   const int reg_used = REG_BX; // register to put chosen promoter code in, for now always BX
-
+  
   // Search for an active promoter  
   int start_offset = m_promoter_offset;
   int start_index  = m_promoter_index;
@@ -5061,12 +5063,12 @@
       // If we just checked the promoter that we were originally on, then there
       // are no active promoters.
       if ( (start_offset == m_promoter_offset) && (start_index == m_promoter_index) ) break;
-
+      
       // If we originally were not on a promoter, then stop once we check the
       // first promoter and an offset of zero
       if (start_index == -1)
       {
-          start_index = 0;
+        start_index = 0;
       }
     } 
   }
@@ -5110,7 +5112,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_BX);
   int regulation_code = GetRegister(reg_used);
-
+  
   for (int i=0; i< m_promoters.GetSize();i++)
   {
     m_promoters[i].m_regulation = regulation_code;
@@ -5213,7 +5215,7 @@
     int state = code >> offset;
     count += (state & 1);
   }
-
+  
   return (count >= m_world->GetConfig().PROMOTER_EXE_THRESHOLD.Get());
 }
 
@@ -5252,10 +5254,10 @@
       code_size++;
     }
     
-     // move back one inst
+    // move back one inst
     j += m_memory.GetSize() + _dir;
     j %= m_memory.GetSize();
-
+    
   }
   
   return code;
@@ -5325,9 +5327,9 @@
 
 
 /*! Send a message to the organism that is currently faced by this cell,
-where the label field of sent message is from register ?BX?, and the data field
-is from register ~?BX?.
-*/
+ where the label field of sent message is from register ?BX?, and the data field
+ is from register ~?BX?.
+ */
 bool cHardwareOrchid::Inst_SendMessage(cAvidaContext& ctx)
 {
   const int label_reg = FindModifiedRegister(REG_BX);
@@ -5340,11 +5342,11 @@
 }
 
 /*! This method /attempts/ to retrieve a message -- It may not be possible, as in
-the case of an empty receive buffer.
-
-If a message is available, ?BX? is set to the message's label, and ~?BX? is set
-to its data.
-*/
+ the case of an empty receive buffer.
+ 
+ If a message is available, ?BX? is set to the message's label, and ~?BX? is set
+ to its data.
+ */
 bool cHardwareOrchid::Inst_RetrieveMessage(cAvidaContext& ctx) 
 {
   const cOrgMessage* msg = organism->RetrieveMessage();
@@ -5388,7 +5390,7 @@
   if(organism->IsSleeping()) {
     return false;
   }
-
+  
   cString channel;
   
   if(jump_label == 1) {
@@ -5448,9 +5450,9 @@
 bool cHardwareOrchid::DoSenseFacing(cAvidaContext& ctx, int conversion_method, double base)
 {
   cPopulationCell& mycell = m_world->GetPopulation().GetCell(organism->GetCellID());
-
+  
   int faced_id = mycell.GetCellFaced().GetID();
-
+  
   // Returns the amount of a resource or resources 
   // specified by modifying NOPs into register BX
   const tArray<double> & res_count = m_world->GetPopulation().GetCellResources(faced_id); 
@@ -5583,11 +5585,11 @@
   int reg_to_set = FindModifiedRegister(REG_CX);
   int cell_data = m_world->GetPopulation().GetCell(organism->GetCellID()).GetCellData();
   int val = 0;
-
+  
   if(cell_data > 0) {
     val = 1;
   }
-
+  
   GetRegister(reg_to_set) = val;
   return true;
 } //End Inst_SenseTarget()
@@ -5595,17 +5597,17 @@
 // Sense if the cell faced is a target -- put 1 in reg is so, 0 otherwise
 bool cHardwareOrchid::Inst_SenseTargetFaced(cAvidaContext& ctx) {
   int reg_to_set = FindModifiedRegister(REG_CX);
-
+  
   cPopulation& pop = m_world->GetPopulation();
   cPopulationCell& mycell = pop.GetCell(organism->GetCellID());
-
+  
   int cell_data = mycell.GetCellFaced().GetCellData(); //absolute id of faced cell
   int val = 0;
-
+  
   if(cell_data > 0) {
     val = 1;
   }
-
+  
   GetRegister(reg_to_set) = val;
   return true;
 } //End Inst_SenseTargetFaced()
@@ -5615,15 +5617,15 @@
 bool cHardwareOrchid::DoSensePheromone(cAvidaContext& ctx, int cellid)
 {
   int reg_to_set = FindModifiedRegister(REG_BX);
-
+  
   cPopulation& pop = m_world->GetPopulation();
   cDeme &deme = pop.GetDeme(pop.GetCell(cellid).GetDemeID());
   int relative_cell_id = deme.GetRelativeCellID(cellid);
-
+  
   cResourceCount deme_resource_count = deme.GetDemeResourceCount();
   tArray<double> cell_resources = deme_resource_count.GetCellResources(relative_cell_id);
   double pher_amount = 0;
-
+  
   if(deme_resource_count.GetSize() == 0) return false;
   
   for (int i = 0; i < deme_resource_count.GetSize(); i++) {
@@ -5631,37 +5633,37 @@
       pher_amount += cell_resources[i];
     }
   }
-
+  
   GetRegister(reg_to_set) = (int)round(pher_amount);
-
+  
   return true;
-
+  
 } //End DoSensePheromone()
 
 bool cHardwareOrchid::Inst_SensePheromone(cAvidaContext& ctx)
 {
   int cellid = organism->GetCellID(); //absolute id of current cell
-
+  
   if(cellid == -1) {
     return true;
   }
-
+  
   return DoSensePheromone(ctx, cellid);
 } //End Inst_SensePheromone()
 
 bool cHardwareOrchid::Inst_SensePheromoneFaced(cAvidaContext& ctx)
 {
   int cellid = organism->GetCellID(); //absolute id of current cell
-
+  
   if(cellid == -1) {
     return true;
   }
-
+  
   cPopulation& pop = m_world->GetPopulation();
   cPopulationCell& mycell = pop.GetCell(cellid);
-
+  
   int fcellid = mycell.GetCellFaced().GetID(); //absolute id of faced cell
-
+  
   return DoSensePheromone(ctx, fcellid);
 } //End Inst_SensePheromoneFacing()
 
@@ -5670,72 +5672,72 @@
   int num_rotations = 0;
   double phero_amount = 0;
   double max_pheromone = 0;
-
+  
   cPopulation& pop = m_world->GetPopulation();
   int cellid = organism->GetCellID();
-
+  
   if(cellid == -1) {
     return true;
   }
-
+  
   cPopulationCell& mycell = pop.GetCell(cellid);
   cDeme &deme = pop.GetDeme(pop.GetCell(cellid).GetDemeID());
   cResourceCount deme_resource_count = deme.GetDemeResourceCount();
-//  int relative_cell_id = deme.GetRelativeCellID(cellid);
+  //  int relative_cell_id = deme.GetRelativeCellID(cellid);
   //tArray<double> cell_resources = deme_resource_count.GetCellResources(relative_cell_id);
   tArray<double> cell_resources;
-
+  
   int fromcellID, destcellID;
   
   // Get stepsize. Currently, all moves are one cell regardless of stepsize.
   // This could be changed in the future.
   const int stepsize = m_world->GetConfig().BIOMIMETIC_MOVEMENT_STEP.Get();
-
+  
   // Pheromone drop stuff
   double pher_amount = 0; // this is used in the logging
   int drop_mode = -1;
-
+  
   if( (m_world->GetConfig().EXPLOIT_EXPLORE_PROB.Get() >= 0) &&
-      (m_world->GetRandom().P(m_world->GetConfig().EXPLOIT_EXPLORE_PROB.Get())) ) {
+     (m_world->GetRandom().P(m_world->GetConfig().EXPLOIT_EXPLORE_PROB.Get())) ) {
     num_rotations = ctx.GetRandom().GetUInt(organism->GetNeighborhoodSize());
   } else {
     // Find which neighbor has the strongest pheromone
     for(int i = 0; i < mycell.ConnectionList().GetSize(); i++) {
-
+      
       phero_amount = 0;
       cell_resources = deme_resource_count.GetCellResources(deme.GetRelativeCellID(mycell.GetCellFaced().GetID()));
-
+      
       for (int j = 0; j < deme_resource_count.GetSize(); j++) {
         if(strncmp(deme_resource_count.GetResName(j), "pheromone", 9) == 0) {
           phero_amount += cell_resources[j];
         }
       }
-
+      
       if(phero_amount > max_pheromone) {
         num_rotations = i;
         max_pheromone = phero_amount;
       }
-
+      
       mycell.ConnectionList().CircNext();
     }
   }
-
+  
   // Rotate until we face the neighbor with the strongest pheromone.
   // If there was no winner, just move forward.
   for(int i = 0; i < num_rotations; i++) {
     mycell.ConnectionList().CircNext();
   }
-
+  
   // Move to the faced cell
   if(stepsize > 0) {
     fromcellID = organism->GetCellID();
-
+    
     if(fromcellID == -1) {
       return false;
     }
-
+    
     destcellID = pop.GetCell(fromcellID).GetCellFaced().GetID();
-
+    
     /*********************/
     // TEMP.  Remove once movement tasks are implemented.
     if(pop.GetCell(fromcellID).GetCellData() < pop.GetCell(destcellID).GetCellData()) { // move up gradient
@@ -5746,55 +5748,55 @@
       organism->SetGradientMovement(-1.0);    
     }
     /*********************/ 
-
+    
     pop.SwapCells(pop.GetCell(fromcellID),pop.GetCell(destcellID));
     pop.MoveOrganisms(ctx, pop.GetCell(fromcellID), pop.GetCell(destcellID));
     
     m_world->GetStats().Move(*organism);
-
+    
     // If organism is dropping pheromones, mark the appropriate cell(s)
     if( (m_world->GetConfig().PHEROMONE_ENABLED.Get() == 1) &&
-        (organism->GetPheromoneStatus() == true) ) {
-
-        pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
-	drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
-	
-	if(drop_mode == 0) {
-          deme.AddPheromone(fromcellID, pher_amount/2);
-          deme.AddPheromone(destcellID, pher_amount/2);
-	} else if(drop_mode == 1) {
-          deme.AddPheromone(fromcellID, pher_amount);
-	}
-	else if(drop_mode == 2) {
-          deme.AddPheromone(destcellID, pher_amount);
-	}
-
+       (organism->GetPheromoneStatus() == true) ) {
+      
+      pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
+      drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
+      
+      if(drop_mode == 0) {
+        deme.AddPheromone(fromcellID, pher_amount/2);
+        deme.AddPheromone(destcellID, pher_amount/2);
+      } else if(drop_mode == 1) {
+        deme.AddPheromone(fromcellID, pher_amount);
+      }
+      else if(drop_mode == 2) {
+        deme.AddPheromone(destcellID, pher_amount);
+      }
+      
     } //End laying pheromone
-
-
+    
+    
     // Write some logging information if LOG_PHEROMONE is set.  This is done
     // out here so that non-pheromone moves are recorded.
     if( (m_world->GetConfig().LOG_PHEROMONE.Get() == 1) &&
-        (m_world->GetStats().GetUpdate() >= m_world->GetConfig().EXPLOIT_LOG_START.Get()) ) {
+       (m_world->GetStats().GetUpdate() >= m_world->GetConfig().EXPLOIT_LOG_START.Get()) ) {
       cString tmpfilename = cStringUtil::Stringf("movelog.dat");
       cDataFile& df = m_world->GetDataFile(tmpfilename);
-
+      
       int rel_srcid = deme.GetRelativeCellID(fromcellID);
       int rel_destid = deme.GetRelativeCellID(destcellID);
-
+      
       cString UpdateStr = cStringUtil::Stringf("%d,%d,%d,%d,%d,%f,%d,3",  m_world->GetStats().GetUpdate(), organism->GetID(), deme.GetDemeID(), rel_srcid, rel_destid, pher_amount, drop_mode);
       df.WriteRaw(UpdateStr);
     }
-
+    
     organism->Move(ctx);
-
+    
     return true;
   } else {
     return false;
   }
-
+  
   return true;
-
+  
 } //End Inst_Exploit()
 
 
@@ -5808,79 +5810,79 @@
   int num_rotations = 0;
   double phero_amount = 0;
   double max_pheromone = 0;
-
+  
   cPopulation& pop = m_world->GetPopulation();
   int cellid = organism->GetCellID();
-
+  
   if(cellid == -1) {
     return true;
   }
-
+  
   cPopulationCell& mycell = pop.GetCell(cellid);
   cDeme &deme = pop.GetDeme(pop.GetCell(cellid).GetDemeID());
   cResourceCount deme_resource_count = deme.GetDemeResourceCount();
-//  int relative_cell_id = deme.GetRelativeCellID(cellid);
+  //  int relative_cell_id = deme.GetRelativeCellID(cellid);
   //tArray<double> cell_resources = deme_resource_count.GetCellResources(relative_cell_id);
   tArray<double> cell_resources;
-
+  
   int fromcellID, destcellID;
   
   // Get stepsize. Currently, all moves are one cell regardless of stepsize.
   // This could be changed in the future.
   const int stepsize = m_world->GetConfig().BIOMIMETIC_MOVEMENT_STEP.Get();
-
+  
   // Pheromone drop stuff
   double pher_amount = 0; // this is used in the logging.
   int drop_mode = -1;
-
-
+  
+  
   if( (m_world->GetConfig().EXPLOIT_EXPLORE_PROB.Get() >= 0) &&
-      (m_world->GetRandom().P(m_world->GetConfig().EXPLOIT_EXPLORE_PROB.Get())) ) {
+     (m_world->GetRandom().P(m_world->GetConfig().EXPLOIT_EXPLORE_PROB.Get())) ) {
     num_rotations = ctx.GetRandom().GetUInt(organism->GetNeighborhoodSize());
   } else {
     // Find which neighbor has the strongest pheromone
     for(int i = 0; i < mycell.ConnectionList().GetSize(); i++) {
-
+      
       // Skip the cells in the back
       if(i == 3 || i == 4 || i == 5) {
         mycell.ConnectionList().CircNext();
         continue;
       }
-
+      
       phero_amount = 0;
       cell_resources = deme_resource_count.GetCellResources(deme.GetRelativeCellID(mycell.GetCellFaced().GetID()));
-
+      
       for (int j = 0; j < deme_resource_count.GetSize(); j++) {
         if(strncmp(deme_resource_count.GetResName(j), "pheromone", 9) == 0) {
           phero_amount += cell_resources[j];
         }
       }
- 
+      
       if(phero_amount > max_pheromone) {
         num_rotations = i;
         max_pheromone = phero_amount;
       }
-
+      
       mycell.ConnectionList().CircNext();
     }
   }
-
+  
   // Rotate until we face the neighbor with the strongest pheromone.
   // If there was no winner, just move forward.
   for(int i = 0; i < num_rotations; i++) {
     mycell.ConnectionList().CircNext();
   }
-
+  
   // Move to the faced cell
   if(stepsize > 0) {
     fromcellID = organism->GetCellID();
-
+    
     if(fromcellID == -1) {
       return false;
     }
-
+    
     destcellID = pop.GetCell(fromcellID).GetCellFaced().GetID();
-
+    
     /*********************/
     // TEMP.  Remove once movement tasks are implemented.
     if(pop.GetCell(fromcellID).GetCellData() < pop.GetCell(destcellID).GetCellData()) { // move up gradient
@@ -5891,55 +5893,55 @@
       organism->SetGradientMovement(-1.0);    
     }
     /*********************/ 
-
+    
     pop.SwapCells(pop.GetCell(fromcellID),pop.GetCell(destcellID));
     pop.MoveOrganisms(ctx, pop.GetCell(fromcellID), pop.GetCell(destcellID));
     
     m_world->GetStats().Move(*organism);
-
+    
     // If organism is dropping pheromones, mark the appropriate cell(s)
     if( (m_world->GetConfig().PHEROMONE_ENABLED.Get() == 1) &&
-        (organism->GetPheromoneStatus() == true) ) {
-
-        pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
-	drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
-	
-	if(drop_mode == 0) {
-          deme.AddPheromone(fromcellID, pher_amount/2);
-          deme.AddPheromone(destcellID, pher_amount/2);
-	} else if(drop_mode == 1) {
-          deme.AddPheromone(fromcellID, pher_amount);
-	}
-	else if(drop_mode == 2) {
-          deme.AddPheromone(destcellID, pher_amount);
-	}
-
+       (organism->GetPheromoneStatus() == true) ) {
+      
+      pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
+      drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
+      
+      if(drop_mode == 0) {
+        deme.AddPheromone(fromcellID, pher_amount/2);
+        deme.AddPheromone(destcellID, pher_amount/2);
+      } else if(drop_mode == 1) {
+        deme.AddPheromone(fromcellID, pher_amount);
+      }
+      else if(drop_mode == 2) {
+        deme.AddPheromone(destcellID, pher_amount);
+      }
+      
     } //End laying pheromone
-
-
+    
+    
     // Write some logging information if LOG_PHEROMONE is set.  This is done
     // out here so that non-pheromone moves are recorded.
     if( (m_world->GetConfig().LOG_PHEROMONE.Get() == 1) &&
-        (m_world->GetStats().GetUpdate() >= m_world->GetConfig().EXPLOIT_LOG_START.Get()) ) {
+       (m_world->GetStats().GetUpdate() >= m_world->GetConfig().EXPLOIT_LOG_START.Get()) ) {
       cString tmpfilename = cStringUtil::Stringf("movelog.dat");
       cDataFile& df = m_world->GetDataFile(tmpfilename);
-
+      
       int rel_srcid = deme.GetRelativeCellID(fromcellID);
       int rel_destid = deme.GetRelativeCellID(destcellID);
-
+      
       cString UpdateStr = cStringUtil::Stringf("%d,%d,%d,%d,%d,%f,%d,7",  m_world->GetStats().GetUpdate(), organism->GetID(), deme.GetDemeID(), rel_srcid, rel_destid, pher_amount, drop_mode);
       df.WriteRaw(UpdateStr);
     }
-
+    
     organism->Move(ctx);
-
+    
     return true;
   } else {
     return false;
   }
-
+  
   return true;
-
+  
 } //End Inst_ExploitForward5()
 
 
@@ -5952,78 +5954,78 @@
   int num_rotations = 0;
   double phero_amount = 0;
   double max_pheromone = 0;
-
+  
   cPopulation& pop = m_world->GetPopulation();
   int cellid = organism->GetCellID();
-
+  
   if(cellid == -1) {
     return true;
   }
-
+  
   cPopulationCell& mycell = pop.GetCell(cellid);
   cDeme &deme = pop.GetDeme(pop.GetCell(cellid).GetDemeID());
   cResourceCount deme_resource_count = deme.GetDemeResourceCount();
-//  int relative_cell_id = deme.GetRelativeCellID(cellid);
+  //  int relative_cell_id = deme.GetRelativeCellID(cellid);
   //tArray<double> cell_resources = deme_resource_count.GetCellResources(relative_cell_id);
   tArray<double> cell_resources;
-
+  
   int fromcellID, destcellID;
   
   // Get stepsize. Currently, all moves are one cell regardless of stepsize.
   // This could be changed in the future.
   const int stepsize = m_world->GetConfig().BIOMIMETIC_MOVEMENT_STEP.Get();
-
+  
   // Pheromone drop stuff
   double pher_amount = 0; // this is used in the logging.
   int drop_mode = -1;
-
+  
   if( (m_world->GetConfig().EXPLOIT_EXPLORE_PROB.Get() >= 0) &&
-      (m_world->GetRandom().P(m_world->GetConfig().EXPLOIT_EXPLORE_PROB.Get())) ) {
+     (m_world->GetRandom().P(m_world->GetConfig().EXPLOIT_EXPLORE_PROB.Get())) ) {
     num_rotations = ctx.GetRandom().GetUInt(organism->GetNeighborhoodSize());
   } else {
     // Find which neighbor has the strongest pheromone
     for(int i = 0; i < mycell.ConnectionList().GetSize(); i++) {
-
+      
       // Skip the cells in the back
       if(i == 2 || i == 3 || i == 4 || i == 5 || i == 6) {
         mycell.ConnectionList().CircNext();
         continue;
       }
-
+      
       phero_amount = 0;
       cell_resources = deme_resource_count.GetCellResources(deme.GetRelativeCellID(mycell.GetCellFaced().GetID()));
-
+      
       for (int j = 0; j < deme_resource_count.GetSize(); j++) {
         if(strncmp(deme_resource_count.GetResName(j), "pheromone", 9) == 0) {
           phero_amount += cell_resources[j];
         }
       }
-
+      
       if(phero_amount > max_pheromone) {
         num_rotations = i;
         max_pheromone = phero_amount;
       }
-
+      
       mycell.ConnectionList().CircNext();
     }
   }
-
+  
   // Rotate until we face the neighbor with the strongest pheromone.
   // If there was no winner, just move forward.
   for(int i = 0; i < num_rotations; i++) {
     mycell.ConnectionList().CircNext();
   }
-
+  
   // Move to the faced cell
   if(stepsize > 0) {
     fromcellID = organism->GetCellID();
-
+    
     if(fromcellID == -1) {
       return false;
     }
-
+    
     destcellID = pop.GetCell(fromcellID).GetCellFaced().GetID();
-
+    
     /*********************/
     // TEMP.  Remove once movement tasks are implemented.
     if(pop.GetCell(fromcellID).GetCellData() < pop.GetCell(destcellID).GetCellData()) { // move up gradient
@@ -6034,100 +6036,100 @@
       organism->SetGradientMovement(-1.0);    
     }
     /*********************/ 
-
+    
     pop.SwapCells(pop.GetCell(fromcellID),pop.GetCell(destcellID));
     pop.MoveOrganisms(ctx, pop.GetCell(fromcellID), pop.GetCell(destcellID));
     
     m_world->GetStats().Move(*organism);
-
+    
     // If organism is dropping pheromones, mark the appropriate cell(s)
     if( (m_world->GetConfig().PHEROMONE_ENABLED.Get() == 1) &&
-        (organism->GetPheromoneStatus() == true) ) {
-
-        pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
-	drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
-	
-	if(drop_mode == 0) {
-          deme.AddPheromone(fromcellID, pher_amount/2);
-          deme.AddPheromone(destcellID, pher_amount/2);
-	} else if(drop_mode == 1) {
-          deme.AddPheromone(fromcellID, pher_amount);
-	}
-	else if(drop_mode == 2) {
-          deme.AddPheromone(destcellID, pher_amount);
-	}
-
+       (organism->GetPheromoneStatus() == true) ) {
+      
+      pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
+      drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
+      
+      if(drop_mode == 0) {
+        deme.AddPheromone(fromcellID, pher_amount/2);
+        deme.AddPheromone(destcellID, pher_amount/2);
+      } else if(drop_mode == 1) {
+        deme.AddPheromone(fromcellID, pher_amount);
+      }
+      else if(drop_mode == 2) {
+        deme.AddPheromone(destcellID, pher_amount);
+      }
+      
     } //End laying pheromone
-
-
+    
+    
     // Write some logging information if LOG_PHEROMONE is set.  This is done
     // out here so that non-pheromone moves are recorded.
     if( (m_world->GetConfig().LOG_PHEROMONE.Get() == 1) &&
-        (m_world->GetStats().GetUpdate() >= m_world->GetConfig().EXPLOIT_LOG_START.Get()) ) {
+       (m_world->GetStats().GetUpdate() >= m_world->GetConfig().EXPLOIT_LOG_START.Get()) ) {
       cString tmpfilename = cStringUtil::Stringf("movelog.dat");
       cDataFile& df = m_world->GetDataFile(tmpfilename);
-
+      
       int rel_srcid = deme.GetRelativeCellID(fromcellID);
       int rel_destid = deme.GetRelativeCellID(destcellID);
-
+      
       cString UpdateStr = cStringUtil::Stringf("%d,%d,%d,%d,%d,%f,%d,9",  m_world->GetStats().GetUpdate(), organism->GetID(), deme.GetDemeID(), rel_srcid, rel_destid, pher_amount, drop_mode);
       df.WriteRaw(UpdateStr);
     }
-
+    
     organism->Move(ctx);
-
+    
     return true;
   } else {
     return false;
   }
-
+  
   return true;
-
+  
 } //End Inst_ExploitForward3()
 
 bool cHardwareOrchid::Inst_Explore(cAvidaContext& ctx)
 {
-//  int num_rotations = 0;
-
+  //  int num_rotations = 0;
+  
   cPopulation& pop = m_world->GetPopulation();
   int cellid = organism->GetCellID();
-
+  
   if(cellid == -1) {
     return true;
   }
-
-//  cPopulationCell& mycell = pop.GetCell(cellid);
+  
+  //  cPopulationCell& mycell = pop.GetCell(cellid);
   cDeme &deme = pop.GetDeme(pop.GetCell(cellid).GetDemeID());
   cResourceCount deme_resource_count = deme.GetDemeResourceCount();
-
+  
   int fromcellID, destcellID;
-//  int cell_data;
-
+  //  int cell_data;
+  
   // Pheromone drop stuff
   double pher_amount = 0;
   int drop_mode = -1;
-
+  
   // Get stepsize. Currently, all moves are one cell regardless of stepsize.
   // This could be changed in the future.
   const int stepsize = m_world->GetConfig().BIOMIMETIC_MOVEMENT_STEP.Get();
-
+  
   // Rotate randomly.  Code taken from tumble.
   const int num_neighbors = organism->GetNeighborhoodSize();
   for(unsigned int i = 0; i < ctx.GetRandom().GetUInt(num_neighbors); i++) {
     organism->Rotate(1);  // Rotate doesn't rotate N times, just once.
   }
-
-
+  
+  
   // Move to the faced cell
   if(stepsize > 0) {
     fromcellID = organism->GetCellID();
-
+    
     if(fromcellID == -1) {
       return false;
     }
-
+    
     destcellID = pop.GetCell(fromcellID).GetCellFaced().GetID();
-
+    
     /*********************/
     // TEMP.  Remove once movement tasks are implemented.
     if(pop.GetCell(fromcellID).GetCellData() < pop.GetCell(destcellID).GetCellData()) { // move up gradient
@@ -6138,55 +6140,55 @@
       organism->SetGradientMovement(-1.0);    
     }
     /*********************/ 
-
+    
     pop.SwapCells(pop.GetCell(fromcellID),pop.GetCell(destcellID));
     pop.MoveOrganisms(ctx, pop.GetCell(fromcellID), pop.GetCell(destcellID));
     
     m_world->GetStats().Move(*organism);
-
+    
     // If organism is dropping pheromones, mark the cells appropriately
     if( (m_world->GetConfig().PHEROMONE_ENABLED.Get() == 1) &&
-        (organism->GetPheromoneStatus() == true) ) {
-
-        pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
-	drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
-	
-	if(drop_mode == 0) {
-          deme.AddPheromone(fromcellID, pher_amount/2);
-          deme.AddPheromone(destcellID, pher_amount/2);
-	} else if(drop_mode == 1) {
-          deme.AddPheromone(fromcellID, pher_amount);
-	}
-	else if(drop_mode == 2) {
-          deme.AddPheromone(destcellID, pher_amount);
-	}
-
+       (organism->GetPheromoneStatus() == true) ) {
+      
+      pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
+      drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
+      
+      if(drop_mode == 0) {
+        deme.AddPheromone(fromcellID, pher_amount/2);
+        deme.AddPheromone(destcellID, pher_amount/2);
+      } else if(drop_mode == 1) {
+        deme.AddPheromone(fromcellID, pher_amount);
+      }
+      else if(drop_mode == 2) {
+        deme.AddPheromone(destcellID, pher_amount);
+      }
+      
     } //End laying pheromone
-
-
+    
+    
     // Write some logging information if LOG_PHEROMONE is set.  This is done
     // out here so that non-pheromone moves are recorded.
     if( (m_world->GetConfig().LOG_PHEROMONE.Get() == 1) &&
-        (m_world->GetStats().GetUpdate() >= m_world->GetConfig().EXPLORE_LOG_START.Get()) ) {
+       (m_world->GetStats().GetUpdate() >= m_world->GetConfig().EXPLORE_LOG_START.Get()) ) {
       cString tmpfilename = cStringUtil::Stringf("movelog.dat");
       cDataFile& df = m_world->GetDataFile(tmpfilename);
-
+      
       int rel_srcid = deme.GetRelativeCellID(fromcellID);
       int rel_destid = deme.GetRelativeCellID(destcellID);
-
+      
       cString UpdateStr = cStringUtil::Stringf("%d,%d,%d,%d,%d,%f,%d,2",  m_world->GetStats().GetUpdate(), organism->GetID(), deme.GetDemeID(), rel_srcid, rel_destid, pher_amount, drop_mode);
       df.WriteRaw(UpdateStr);
     }
-
+    
     organism->Move(ctx);
-
+    
     return true;
   } else {
     return false;
   }
-
+  
   return true;
-
+  
 } // End Inst_Explore()
 
 // This command should move the organism to the neighbor cell that is a
@@ -6196,58 +6198,58 @@
 bool cHardwareOrchid::Inst_MoveTarget(cAvidaContext& ctx)
 {
   int num_rotations = 0;
-
+  
   cPopulation& pop = m_world->GetPopulation();
   int cellid = organism->GetCellID();
-
+  
   if(cellid == -1) {
     return true;
   }
-
+  
   cPopulationCell& mycell = pop.GetCell(cellid);
   cDeme &deme = pop.GetDeme(pop.GetCell(cellid).GetDemeID());
-//  const cResourceCount& deme_resource_count = deme.GetDemeResourceCount();
-
+  //  const cResourceCount& deme_resource_count = deme.GetDemeResourceCount();
+  
   int fromcellID, destcellID;
   int cell_data;
   
   // Get stepsize. Currently, all moves are one cell regardless of stepsize.
   // This could be changed in the future.
   const int stepsize = m_world->GetConfig().BIOMIMETIC_MOVEMENT_STEP.Get();
-
+  
   // Pheromone drop stuff
   double pher_amount = 0; // this is used in logging
   int drop_mode = -1;
-
+  
   cPopulationCell faced = mycell.GetCellFaced();
-
+  
   // Find if any neighbor is a target
   for(int i = 0; i < mycell.ConnectionList().GetSize(); i++) {
     cell_data = mycell.GetCellFaced().GetCellData();
-
+    
     if(cell_data > 0) {
       num_rotations = i;
     }
-
+    
     mycell.ConnectionList().CircNext();
   }
-
+  
   // Rotate until we face the neighbor with a target.
   // If there was no winner, just move forward.
   for(int i = 0; i < num_rotations; i++) {
     mycell.ConnectionList().CircNext();
   }
-
+  
   // Move to the faced cell
   if(stepsize > 0) {
     fromcellID = organism->GetCellID();
-
+    
     if(fromcellID == -1) {
       return false;
     }
-
+    
     destcellID = pop.GetCell(fromcellID).GetCellFaced().GetID();
-
+    
     /*********************/
     // TEMP.  Remove once movement tasks are implemented.
     if(pop.GetCell(fromcellID).GetCellData() < pop.GetCell(destcellID).GetCellData()) { // move up gradient
@@ -6258,56 +6260,56 @@
       organism->SetGradientMovement(-1.0);    
     }
     /*********************/ 
-
+    
     pop.SwapCells(pop.GetCell(fromcellID),pop.GetCell(destcellID));
     pop.MoveOrganisms(ctx, pop.GetCell(fromcellID), pop.GetCell(destcellID));
     
     m_world->GetStats().Move(*organism);
-
-
+    
+    
     // If organism is dropping pheromones, mark the appropriate cell(s)
     if( (m_world->GetConfig().PHEROMONE_ENABLED.Get() == 1) &&
-        (organism->GetPheromoneStatus() == true) ) {
-
-        pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
-	drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
-	
-	if(drop_mode == 0) {
-          deme.AddPheromone(fromcellID, pher_amount/2);
-          deme.AddPheromone(destcellID, pher_amount/2);
-	} else if(drop_mode == 1) {
-          deme.AddPheromone(fromcellID, pher_amount);
-	}
-	else if(drop_mode == 2) {
-          deme.AddPheromone(destcellID, pher_amount);
-	}
-
+       (organism->GetPheromoneStatus() == true) ) {
+      
+      pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
+      drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
+      
+      if(drop_mode == 0) {
+        deme.AddPheromone(fromcellID, pher_amount/2);
+        deme.AddPheromone(destcellID, pher_amount/2);
+      } else if(drop_mode == 1) {
+        deme.AddPheromone(fromcellID, pher_amount);
+      }
+      else if(drop_mode == 2) {
+        deme.AddPheromone(destcellID, pher_amount);
+      }
+      
     } //End laying pheromone
-
-
+    
+    
     // Write some logging information if LOG_PHEROMONE is set.  This is done
     // out here so that non-pheromone moves are recorded.
     if( (m_world->GetConfig().LOG_PHEROMONE.Get() == 1) &&
-        (m_world->GetStats().GetUpdate() >= m_world->GetConfig().MOVETARGET_LOG_START.Get()) ) {
+       (m_world->GetStats().GetUpdate() >= m_world->GetConfig().MOVETARGET_LOG_START.Get()) ) {
       cString tmpfilename = cStringUtil::Stringf("movelog.dat");
       cDataFile& df = m_world->GetDataFile(tmpfilename);
-
+      
       int rel_srcid = deme.GetRelativeCellID(fromcellID);
       int rel_destid = deme.GetRelativeCellID(destcellID);
-
+      
       cString UpdateStr = cStringUtil::Stringf("%d,%d,%d,%d,%d,%f,%d,1",  m_world->GetStats().GetUpdate(), organism->GetID(), deme.GetDemeID(), rel_srcid, rel_destid, pher_amount, drop_mode);
       df.WriteRaw(UpdateStr);
     }
-
+    
     organism->Move(ctx);
-
+    
     return true;
   } else {
     return false;
   }
-
+  
   return true;
-
+  
 } // End Inst_MoveTarget()
 
 
@@ -6320,31 +6322,31 @@
 bool cHardwareOrchid::Inst_MoveTargetForward5(cAvidaContext& ctx)
 {
   int num_rotations = 0;
-
+  
   cPopulation& pop = m_world->GetPopulation();
   int cellid = organism->GetCellID();
-
+  
   if(cellid == -1) {
     return true;
   }
-
+  
   cPopulationCell& mycell = pop.GetCell(cellid);
   cDeme &deme = pop.GetDeme(pop.GetCell(cellid).GetDemeID());
   cResourceCount deme_resource_count = deme.GetDemeResourceCount();
-
+  
   int fromcellID, destcellID;
   int cell_data;
   
   // Get stepsize. Currently, all moves are one cell regardless of stepsize.
   // This could be changed in the future.
   const int stepsize = m_world->GetConfig().BIOMIMETIC_MOVEMENT_STEP.Get();
-
+  
   // Pheromone drop stuff
   double pher_amount = 0;
   int drop_mode = -1;
-
+  
   cPopulationCell faced = mycell.GetCellFaced();
-
+  
   // Find if any neighbor is a target
   for(int i = 0; i < mycell.ConnectionList().GetSize(); i++) {
     
@@ -6353,34 +6355,34 @@
       mycell.ConnectionList().CircNext();
       continue;
     }
-
+    
     cell_data = mycell.GetCellFaced().GetCellData();
-
+    
     if(cell_data > 0) {
       num_rotations = i;
     }
-
+    
     mycell.ConnectionList().CircNext();
   }
-
-//  assert(faced == pop.GetCell(fromcellID).GetCellFaced());
-
+  
+  //  assert(faced == pop.GetCell(fromcellID).GetCellFaced());
+  
   // Rotate until we face the neighbor with a target.
   // If there was no winner, just move forward.
   for(int i = 0; i < num_rotations; i++) {
     mycell.ConnectionList().CircNext();
   }
-
+  
   // Move to the faced cell
   if(stepsize > 0) {
     fromcellID = organism->GetCellID();
-
+    
     if(fromcellID == -1) {
       return false;
     }
-
+    
     destcellID = pop.GetCell(fromcellID).GetCellFaced().GetID();
-
+    
     /*********************/
     // TEMP.  Remove once movement tasks are implemented.
     if(pop.GetCell(fromcellID).GetCellData() < pop.GetCell(destcellID).GetCellData()) { // move up gradient
@@ -6391,56 +6393,56 @@
       organism->SetGradientMovement(-1.0);    
     }
     /*********************/ 
-
+    
     pop.SwapCells(pop.GetCell(fromcellID),pop.GetCell(destcellID));
     pop.MoveOrganisms(ctx, pop.GetCell(fromcellID), pop.GetCell(destcellID));
     
     m_world->GetStats().Move(*organism);
-
-
+    
+    
     // If organism is dropping pheromones, mark the appropriate cell(s)
     if( (m_world->GetConfig().PHEROMONE_ENABLED.Get() == 1) &&
-        (organism->GetPheromoneStatus() == true) ) {
-
-        pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
-	drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
-	
-	if(drop_mode == 0) {
-          deme.AddPheromone(fromcellID, pher_amount/2);
-          deme.AddPheromone(destcellID, pher_amount/2);
-	} else if(drop_mode == 1) {
-          deme.AddPheromone(fromcellID, pher_amount);
-	}
-	else if(drop_mode == 2) {
-          deme.AddPheromone(destcellID, pher_amount);
-	}
-
+       (organism->GetPheromoneStatus() == true) ) {
+      
+      pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
+      drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
+      
+      if(drop_mode == 0) {
+        deme.AddPheromone(fromcellID, pher_amount/2);
+        deme.AddPheromone(destcellID, pher_amount/2);
+      } else if(drop_mode == 1) {
+        deme.AddPheromone(fromcellID, pher_amount);
+      }
+      else if(drop_mode == 2) {
+        deme.AddPheromone(destcellID, pher_amount);
+      }
+      
     } //End laying pheromone
-
-
+    
+    
     // Write some logging information if LOG_PHEROMONE is set.  This is done
     // out here so that non-pheromone moves are recorded.
     if( (m_world->GetConfig().LOG_PHEROMONE.Get() == 1) &&
-        (m_world->GetStats().GetUpdate() >= m_world->GetConfig().MOVETARGET_LOG_START.Get()) ) {
+       (m_world->GetStats().GetUpdate() >= m_world->GetConfig().MOVETARGET_LOG_START.Get()) ) {
       cString tmpfilename = cStringUtil::Stringf("movelog.dat");
       cDataFile& df = m_world->GetDataFile(tmpfilename);
-
+      
       int rel_srcid = deme.GetRelativeCellID(fromcellID);
       int rel_destid = deme.GetRelativeCellID(destcellID);
-
+      
       cString UpdateStr = cStringUtil::Stringf("%d,%d,%d,%d,%d,%f,%d,6",  m_world->GetStats().GetUpdate(), organism->GetID(), deme.GetDemeID(), rel_srcid, rel_destid, pher_amount, drop_mode);
       df.WriteRaw(UpdateStr);
     }
-
+    
     organism->Move(ctx);
-
+    
     return true;
   } else {
     return false;
   }
-
+  
   return true;
-
+  
 } // End Inst_MoveTargetForward5()
 
 
@@ -6452,31 +6454,31 @@
 bool cHardwareOrchid::Inst_MoveTargetForward3(cAvidaContext& ctx)
 {
   int num_rotations = 0;
-
+  
   cPopulation& pop = m_world->GetPopulation();
   int cellid = organism->GetCellID();
-
+  
   if(cellid == -1) {
     return true;
   }
-
+  
   cPopulationCell& mycell = pop.GetCell(cellid);
   cDeme &deme = pop.GetDeme(pop.GetCell(cellid).GetDemeID());
   cResourceCount deme_resource_count = deme.GetDemeResourceCount();
-
+  
   int fromcellID, destcellID;
   int cell_data;
   
   // Get stepsize. Currently, all moves are one cell regardless of stepsize.
   // This could be changed in the future.
   const int stepsize = m_world->GetConfig().BIOMIMETIC_MOVEMENT_STEP.Get();
-
+  
   // Pheromone drop stuff
   double pher_amount = 0;
   int drop_mode = -1;
-
+  
   cPopulationCell faced = mycell.GetCellFaced();
-
+  
   // Find if any neighbor is a target
   for(int i = 0; i < mycell.ConnectionList().GetSize(); i++) {
     
@@ -6485,34 +6487,34 @@
       mycell.ConnectionList().CircNext();
       continue;
     }
-
+    
     cell_data = mycell.GetCellFaced().GetCellData();
-
+    
     if(cell_data > 0) {
       num_rotations = i;
     }
-
+    
     mycell.ConnectionList().CircNext();
   }
-
-//  assert(faced == pop.GetCell(fromcellID).GetCellFaced());
-
+  
+  //  assert(faced == pop.GetCell(fromcellID).GetCellFaced());
+  
   // Rotate until we face the neighbor with a target.
   // If there was no winner, just move forward.
   for(int i = 0; i < num_rotations; i++) {
     mycell.ConnectionList().CircNext();
   }
-
+  
   // Move to the faced cell
   if(stepsize > 0) {
     fromcellID = organism->GetCellID();
-
+    
     if(fromcellID == -1) {
       return false;
     }
-
+    
     destcellID = pop.GetCell(fromcellID).GetCellFaced().GetID();
-
+    
     /*********************/
     // TEMP.  Remove once movement tasks are implemented.
     if(pop.GetCell(fromcellID).GetCellData() < pop.GetCell(destcellID).GetCellData()) { // move up gradient
@@ -6523,56 +6525,56 @@
       organism->SetGradientMovement(-1.0);    
     }
     /*********************/ 
-
+    
     pop.SwapCells(pop.GetCell(fromcellID),pop.GetCell(destcellID));
     pop.MoveOrganisms(ctx, pop.GetCell(fromcellID), pop.GetCell(destcellID));
     
     m_world->GetStats().Move(*organism);
-
-
+    
+    
     // If organism is dropping pheromones, mark the appropriate cell(s)
     if( (m_world->GetConfig().PHEROMONE_ENABLED.Get() == 1) &&
-        (organism->GetPheromoneStatus() == true) ) {
-
-        pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
-	drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
-	
-	if(drop_mode == 0) {
-          deme.AddPheromone(fromcellID, pher_amount/2);
-          deme.AddPheromone(destcellID, pher_amount/2);
-	} else if(drop_mode == 1) {
-          deme.AddPheromone(fromcellID, pher_amount);
-	}
-	else if(drop_mode == 2) {
-          deme.AddPheromone(destcellID, pher_amount);
-	}
-
+       (organism->GetPheromoneStatus() == true) ) {
+      
+      pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
+      drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
+      
+      if(drop_mode == 0) {
+        deme.AddPheromone(fromcellID, pher_amount/2);
+        deme.AddPheromone(destcellID, pher_amount/2);
+      } else if(drop_mode == 1) {
+        deme.AddPheromone(fromcellID, pher_amount);
+      }
+      else if(drop_mode == 2) {
+        deme.AddPheromone(destcellID, pher_amount);
+      }
+      
     } //End laying pheromone
-
-
+    
+    
     // Write some logging information if LOG_PHEROMONE is set.  This is done
     // out here so that non-pheromone moves are recorded.
     if( (m_world->GetConfig().LOG_PHEROMONE.Get() == 1) &&
-        (m_world->GetStats().GetUpdate() >= m_world->GetConfig().MOVETARGET_LOG_START.Get()) ) {
+       (m_world->GetStats().GetUpdate() >= m_world->GetConfig().MOVETARGET_LOG_START.Get()) ) {
       cString tmpfilename = cStringUtil::Stringf("movelog.dat");
       cDataFile& df = m_world->GetDataFile(tmpfilename);
-
+      
       int rel_srcid = deme.GetRelativeCellID(fromcellID);
       int rel_destid = deme.GetRelativeCellID(destcellID);
-
+      
       cString UpdateStr = cStringUtil::Stringf("%d,%d,%d,%d,%d,%f,%d,8",  m_world->GetStats().GetUpdate(), organism->GetID(), deme.GetDemeID(), rel_srcid, rel_destid, pher_amount, drop_mode);
       df.WriteRaw(UpdateStr);
     }
-
+    
     organism->Move(ctx);
-
+    
     return true;
   } else {
     return false;
   }
-
+  
   return true;
-
+  
 } // End Inst_MoveTargetForward3()
 
 bool cHardwareOrchid::Inst_SuperMove(cAvidaContext& ctx)
@@ -6580,83 +6582,83 @@
   int num_rotations = 0;
   float phero_amount = 0;
   float max_pheromone = 0;
-
+  
   cPopulation& pop = m_world->GetPopulation();
   int cellid = organism->GetCellID();
-
+  
   if(cellid == -1) {
     return true;
   }
-
+  
   cPopulationCell& mycell = pop.GetCell(cellid);
   cDeme &deme = pop.GetDeme(pop.GetCell(cellid).GetDemeID());
   cResourceCount deme_resource_count = deme.GetDemeResourceCount();
   int relative_cell_id = deme.GetRelativeCellID(cellid);
   tArray<double> cell_resources = deme_resource_count.GetCellResources(relative_cell_id);
-
+  
   int fromcellID, destcellID;
   int cell_data;
   
   // Get stepsize. Currently, all moves are one cell regardless of stepsize.
   // This could be changed in the future.
   const int stepsize = m_world->GetConfig().BIOMIMETIC_MOVEMENT_STEP.Get();
-
+  
   // Pheromone drop stuff
   double pher_amount = 0;
   int drop_mode = -1;
-
+  
   // Set num_rotations to a random number for explore -- lowest priority
   const int num_neighbors = organism->GetNeighborhoodSize();
   num_rotations = ctx.GetRandom().GetUInt(num_neighbors);
-
-
+  
+  
   // Find the neighbor with highest pheromone -- medium priority
   for(int i = 0; i < mycell.ConnectionList().GetSize(); i++) {
-
+    
     phero_amount = 0;
     cell_resources = deme_resource_count.GetCellResources(deme.GetRelativeCellID(mycell.GetCellFaced().GetID()));
-
+    
     for (int j = 0; j < deme_resource_count.GetSize(); j++) {
       if(strncmp(deme_resource_count.GetResName(j), "pheromone", 9) == 0) {
         phero_amount += cell_resources[j];
       }
     }
-
+    
     if(phero_amount > max_pheromone) {
       num_rotations = i;
       max_pheromone = phero_amount;
     }
-
+    
     mycell.ConnectionList().CircNext();
   }
-
+  
   // Find if any neighbor is a target -- highest priority
   for(int i = 0; i < mycell.ConnectionList().GetSize(); i++) {
     cell_data = mycell.GetCellFaced().GetCellData();
-
+    
     if(cell_data > 0) {
       num_rotations = i;
     }
-
+    
     mycell.ConnectionList().CircNext();
   }
-
+  
   // Rotate until we face the neighbor with a target.
   // If there was no winner, just move forward.
   for(int i = 0; i < num_rotations; i++) {
     mycell.ConnectionList().CircNext();
   }
-
+  
   // Move to the faced cell
   if(stepsize > 0) {
     fromcellID = organism->GetCellID();
-
+    
     if(fromcellID == -1) {
       return false;
     }
-
+    
     destcellID = pop.GetCell(fromcellID).GetCellFaced().GetID();
-
+    
     /*********************/
     // TEMP.  Remove once movement tasks are implemented.
     if(pop.GetCell(fromcellID).GetCellData() < pop.GetCell(destcellID).GetCellData()) { // move up gradient
@@ -6667,65 +6669,65 @@
       organism->SetGradientMovement(-1.0);    
     }
     /*********************/ 
-
+    
     pop.SwapCells(pop.GetCell(fromcellID),pop.GetCell(destcellID));
     pop.MoveOrganisms(ctx, pop.GetCell(fromcellID), pop.GetCell(destcellID));
     
     m_world->GetStats().Move(*organism);
-
+    
     // If organism is dropping pheromones, mark the appropriate cell(s)
     if( (m_world->GetConfig().PHEROMONE_ENABLED.Get() == 1) &&
-        (organism->GetPheromoneStatus() == true) ) {
-
-        pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
-	drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
-	
-	if(drop_mode == 0) {
-          deme.AddPheromone(fromcellID, pher_amount/2);
-          deme.AddPheromone(destcellID, pher_amount/2);
-	} else if(drop_mode == 1) {
-          deme.AddPheromone(fromcellID, pher_amount);
-	}
-	else if(drop_mode == 2) {
-          deme.AddPheromone(destcellID, pher_amount);
-	}
-
+       (organism->GetPheromoneStatus() == true) ) {
+      
+      pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
+      drop_mode = m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
+      
+      if(drop_mode == 0) {
+        deme.AddPheromone(fromcellID, pher_amount/2);
+        deme.AddPheromone(destcellID, pher_amount/2);
+      } else if(drop_mode == 1) {
+        deme.AddPheromone(fromcellID, pher_amount);
+      }
+      else if(drop_mode == 2) {
+        deme.AddPheromone(destcellID, pher_amount);
+      }
+      
     } //End laying pheromone
-
-
+    
+    
     // Write some logging information if LOG_PHEROMONE is set.  This is done
     // out here so that non-pheromone moves are recorded.
     if( (m_world->GetConfig().LOG_PHEROMONE.Get() == 1) &&
-        (m_world->GetStats().GetUpdate() >= m_world->GetConfig().MOVETARGET_LOG_START.Get()) ) {
+       (m_world->GetStats().GetUpdate() >= m_world->GetConfig().MOVETARGET_LOG_START.Get()) ) {
       cString tmpfilename = cStringUtil::Stringf("movelog.dat");
       cDataFile& df = m_world->GetDataFile(tmpfilename);
-
+      
       int rel_srcid = deme.GetRelativeCellID(fromcellID);
       int rel_destid = deme.GetRelativeCellID(destcellID);
-
+      
       cString UpdateStr = cStringUtil::Stringf("%d,%d,%d,%d,%d,%f,%d,4",  m_world->GetStats().GetUpdate(), organism->GetID(), deme.GetDemeID(), rel_srcid, rel_destid, pher_amount, drop_mode);
       df.WriteRaw(UpdateStr);
     }
-
+    
     organism->Move(ctx);
-
+    
     return true;
   } else {
     return false;
   }
-
+  
   return true;
-
+  
 } // End Inst_SuperMove()
 
 bool cHardwareOrchid::Inst_IfTarget(cAvidaContext& ctx)
 {
   int cell_data = m_world->GetPopulation().GetCell(organism->GetCellID()).GetCellData();
-
+  
   if(cell_data == -1) {
     IP().Advance();
   }
-
+  
   return true;
 } //End Inst_IfTarget()
 
@@ -6733,11 +6735,11 @@
 bool cHardwareOrchid::Inst_IfNotTarget(cAvidaContext& ctx)
 {
   int cell_data = m_world->GetPopulation().GetCell(organism->GetCellID()).GetCellData();
-
+  
   if(cell_data > 0) {
     IP().Advance();
   }
-
+  
   return true;
 } //End Inst_IfNotTarget()
 
@@ -6745,20 +6747,20 @@
 bool cHardwareOrchid::Inst_IfPheromone(cAvidaContext& ctx)
 {
   int cellid = organism->GetCellID(); //absolute id of current cell
-
+  
   if(cellid == -1) {
     return true;
   }
-
+  
   cPopulation& pop = m_world->GetPopulation();
   cDeme &deme = pop.GetDeme(pop.GetCell(cellid).GetDemeID());
   int relative_cell_id = deme.GetRelativeCellID(cellid);
-
+  
   cResourceCount deme_resource_count = deme.GetDemeResourceCount();
   tArray<double> cell_resources = deme_resource_count.GetCellResources(relative_cell_id);
-
+  
   if(deme_resource_count.GetSize() == 0) return false;
-
+  
   double pher_amount = 0;
   
   for (int i = 0; i < deme_resource_count.GetSize(); i++) {
@@ -6766,33 +6768,33 @@
       pher_amount += cell_resources[i];
     }
   }
-
+  
   if(pher_amount == 0) {
     IP().Advance();
   }
-
+  
   return true;
-
+  
 } //End Inst_IfPheromone()
 
 
 bool cHardwareOrchid::Inst_IfNotPheromone(cAvidaContext& ctx)
 {
   int cellid = organism->GetCellID(); //absolute id of current cell
-
+  
   if(cellid == -1) {
     return true;
   }
-
+  
   cPopulation& pop = m_world->GetPopulation();
   cDeme &deme = pop.GetDeme(pop.GetCell(cellid).GetDemeID());
   int relative_cell_id = deme.GetRelativeCellID(cellid);
-
+  
   cResourceCount deme_resource_count = deme.GetDemeResourceCount();
   tArray<double> cell_resources = deme_resource_count.GetCellResources(relative_cell_id);
-
+  
   if(deme_resource_count.GetSize() == 0) return false;
-
+  
   double pher_amount = 0;
   
   for (int i = 0; i < deme_resource_count.GetSize(); i++) {
@@ -6800,13 +6802,13 @@
       pher_amount += cell_resources[i];
     }
   }
-
+  
   if(pher_amount > 0) {
     IP().Advance();
   }
-
+  
   return true;
-
+  
 } //End Inst_IfNotPheromone()
 
 
@@ -6814,448 +6816,487 @@
 {
   cPopulation& pop = m_world->GetPopulation();
   int cellid = organism->GetCellID();
-
+  
   if(cellid == -1) {
     return true;
   }
-
+  
   cDeme &deme = pop.GetDeme(pop.GetCell(cellid).GetDemeID());
-
+  
   // If organism is dropping pheromones, mark the appropriate cell
   // Note: right now, we're ignoring the organism's pheromone status and always
   //   dropping if pheromones are enabled
   if(m_world->GetConfig().PHEROMONE_ENABLED.Get() == 1) {
-	
+    
     const double pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
     //const int drop_mode =  m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
-
+    
     // We can't use the different drop modes, because we only know the cell
     // that the organism is currently in.
     /*
-    if(drop_mode == 0) {
-      deme.AddPheromone(fromcellID, pher_amount/2);
-      deme.AddPheromone(destcellID, pher_amount/2);
-    } else if(drop_mode == 1) {
-      deme.AddPheromone(fromcellID, pher_amount);
-    } else if(drop_mode == 2) {
-      deme.AddPheromone(destcellID, pher_amount);
-    }
-    */
+     if(drop_mode == 0) {
+     deme.AddPheromone(fromcellID, pher_amount/2);
+     deme.AddPheromone(destcellID, pher_amount/2);
+     } else if(drop_mode == 1) {
+     deme.AddPheromone(fromcellID, pher_amount);
+     } else if(drop_mode == 2) {
+     deme.AddPheromone(destcellID, pher_amount);
+     }
+     */
     deme.AddPheromone(cellid, pher_amount);
     
     // Write some logging information if LOG_PHEROMONE is set.  This is done
     // out here so that non-pheromone moves are recorded.
     if( (m_world->GetConfig().LOG_PHEROMONE.Get() == 1) &&
-        (m_world->GetStats().GetUpdate() >= m_world->GetConfig().PHEROMONE_LOG_START.Get()) ) {
+       (m_world->GetStats().GetUpdate() >= m_world->GetConfig().PHEROMONE_LOG_START.Get()) ) {
       cString tmpfilename = cStringUtil::Stringf("drop-pheromone-log.dat");
       cDataFile& df = m_world->GetDataFile(tmpfilename);
-
+      
       int rel_cellid = deme.GetRelativeCellID(cellid);
       double pher_amount;
       const int drop_mode =  m_world->GetConfig().PHEROMONE_DROP_MODE.Get();
-
+      
       // By columns: update ID, org ID, source cell (relative), destination cell (relative), amount dropped, drop mode
       if( (m_world->GetConfig().PHEROMONE_ENABLED.Get() == 1) &&
-          (organism->GetPheromoneStatus() == true) ) {
+         (organism->GetPheromoneStatus() == true) ) {
         pher_amount = m_world->GetConfig().PHEROMONE_AMOUNT.Get();
       } else {
         pher_amount = 0;
       }
-
+      
       cString UpdateStr = cStringUtil::Stringf("%d,%d,%d,%d,%f,%d",  m_world->GetStats().GetUpdate(), organism->GetID(), deme.GetDemeID(), rel_cellid, pher_amount, drop_mode);
       df.WriteRaw(UpdateStr);
     }
-
+    
   } //End laying pheromone
-
+  
   return true;
-
+  
 } //End Inst_DropPheromone()
 
 
 // -------- Orchid instructions --------
-//// UML Element Construction ////
-
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_AddTransitionFromLabel(cAvidaContext& ctx)
 {
-	if(organism->GetCellID()==-1) return false;
-	
-	//organism->modelCheck(ctx);
-	
-	return organism->GetStateDiagram()->AddTransitionFromLabel();
-	
+	return organism->GetOrchidOrganism()->GetStateDiagram()->AddTransitionFromLabel();
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_AddTransitionTotal(cAvidaContext& ctx)
 {
-	if(organism->GetCellID()==-1) return false;
-	
-	//organism->modelCheck(ctx);
-  
-	return organism->AddTransitionTotal();
+	return organism->GetOrchidOrganism()->AddTransitionTotal();
 }
 
 
+/* These instructions...
+ */
 bool cHardwareOrchid::Inst_StateDiag0(cAvidaContext& ctx)
-{ return (organism->AbsoluteJumpStateDiagram(0)); }
+{ return (organism->GetOrchidOrganism()->AbsoluteJumpStateDiagram(0)); }
 
 bool cHardwareOrchid::Inst_StateDiag1(cAvidaContext& ctx)
-{ return (organism->AbsoluteJumpStateDiagram(1)); }
+{ return (organism->GetOrchidOrganism()->AbsoluteJumpStateDiagram(1)); }
 
 bool cHardwareOrchid::Inst_StateDiag2(cAvidaContext& ctx)
-{ return (organism->AbsoluteJumpStateDiagram(2)); }
+{ return (organism->GetOrchidOrganism()->AbsoluteJumpStateDiagram(2)); }
 
 bool cHardwareOrchid::Inst_StateDiag3(cAvidaContext& ctx)
-{ return (organism->AbsoluteJumpStateDiagram(3)); }
+{ return (organism->GetOrchidOrganism()->AbsoluteJumpStateDiagram(3)); }
 
-
 bool cHardwareOrchid::Inst_OrigState0(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpOriginState(0)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpOriginState(0)); }
 
 bool cHardwareOrchid::Inst_OrigState1(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpOriginState(1)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpOriginState(1)); }
 
 bool cHardwareOrchid::Inst_OrigState2(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpOriginState(2)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpOriginState(2)); }
 
 bool cHardwareOrchid::Inst_OrigState3(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpOriginState(3)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpOriginState(3)); }
 
 bool cHardwareOrchid::Inst_OrigState4(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpOriginState(4)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpOriginState(4)); }
 
 bool cHardwareOrchid::Inst_OrigState5(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpOriginState(5)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpOriginState(5)); }
 
 bool cHardwareOrchid::Inst_OrigState6(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpOriginState(6)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpOriginState(6)); }
 
 bool cHardwareOrchid::Inst_OrigState7(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpOriginState(7)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpOriginState(7)); }
 
 bool cHardwareOrchid::Inst_OrigState8(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpOriginState(8)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpOriginState(8)); }
 
 bool cHardwareOrchid::Inst_OrigState9(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpOriginState(9)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpOriginState(9)); }
 
 bool cHardwareOrchid::Inst_OrigState10(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpOriginState(10)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpOriginState(10)); }
 
 bool cHardwareOrchid::Inst_OrigState11(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpOriginState(11)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpOriginState(11)); }
 
 bool cHardwareOrchid::Inst_OrigState12(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpOriginState(12)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpOriginState(12)); }
 
 bool cHardwareOrchid::Inst_DestState0(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpDestinationState(0)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpDestinationState(0)); }
 
 bool cHardwareOrchid::Inst_DestState1(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpDestinationState(1)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpDestinationState(1)); }
 
 bool cHardwareOrchid::Inst_DestState2(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpDestinationState(2)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpDestinationState(2)); }
 
 bool cHardwareOrchid::Inst_DestState3(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpDestinationState(3)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpDestinationState(3)); }
 
 bool cHardwareOrchid::Inst_DestState4(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpDestinationState(4)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpDestinationState(4)); }
 
 bool cHardwareOrchid::Inst_DestState5(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpDestinationState(5)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpDestinationState(5)); }
 
 bool cHardwareOrchid::Inst_DestState6(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpDestinationState(6)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpDestinationState(6)); }
 
 bool cHardwareOrchid::Inst_DestState7(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpDestinationState(7)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpDestinationState(7)); }
 
 bool cHardwareOrchid::Inst_DestState8(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpDestinationState(8)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpDestinationState(8)); }
 
 bool cHardwareOrchid::Inst_DestState9(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpDestinationState(9)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpDestinationState(9)); }
 
 bool cHardwareOrchid::Inst_DestState10(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpDestinationState(10)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpDestinationState(10)); }
 
 bool cHardwareOrchid::Inst_DestState11(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpDestinationState(11)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpDestinationState(11)); }
 
 bool cHardwareOrchid::Inst_DestState12(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpDestinationState(12)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpDestinationState(12)); }
 
 bool cHardwareOrchid::Inst_TransLab0(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(0)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(0)); }
 
 bool cHardwareOrchid::Inst_TransLab1(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(1)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(1)); }
 
 bool cHardwareOrchid::Inst_TransLab2(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(2)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(2)); }
 
 bool cHardwareOrchid::Inst_TransLab3(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(3)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(3)); }
 
 bool cHardwareOrchid::Inst_TransLab4(cAvidaContext& ctx)
-{ 
-return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(4)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(4)); }
 
 bool cHardwareOrchid::Inst_TransLab5(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(5)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(5)); }
 
 bool cHardwareOrchid::Inst_TransLab6(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(6)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(6)); }
 
 bool cHardwareOrchid::Inst_TransLab7(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(7)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(7)); }
 
 bool cHardwareOrchid::Inst_TransLab8(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(8)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(8)); }
 
 bool cHardwareOrchid::Inst_TransLab9(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(9)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(9)); }
 
 bool cHardwareOrchid::Inst_TransLab10(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(10)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(10)); }
 
 bool cHardwareOrchid::Inst_TransLab11(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(11)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(11)); }
 
 bool cHardwareOrchid::Inst_TransLab12(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(12)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(12)); }
 
 bool cHardwareOrchid::Inst_TransLab13(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(13)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(13)); }
 
 bool cHardwareOrchid::Inst_TransLab14(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(14)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(14)); }
 
 bool cHardwareOrchid::Inst_TransLab15(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(15)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(15)); }
 
 bool cHardwareOrchid::Inst_TransLab16(cAvidaContext& ctx)
-{ return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(16)); }
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(16)); }
 
+bool cHardwareOrchid::Inst_Trigger0(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTrigger(0)); }
 
- bool cHardwareOrchid::Inst_Trigger0(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpTrigger(0)); }
- 
- bool cHardwareOrchid::Inst_Trigger1(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpTrigger(1)); }
- 
- bool cHardwareOrchid::Inst_Trigger2(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpTrigger(2)); }
- 
- bool cHardwareOrchid::Inst_Trigger3(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpTrigger(3)); }
- 
- bool cHardwareOrchid::Inst_Trigger4(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpTrigger(4)); }
- 
- bool cHardwareOrchid::Inst_Trigger5(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpTrigger(5)); }
- 
- bool cHardwareOrchid::Inst_Trigger6(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpTrigger(6)); }
- 
- bool cHardwareOrchid::Inst_Trigger7(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpTrigger(7)); }
- 
- bool cHardwareOrchid::Inst_Trigger8(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpTrigger(8)); }
- 
- bool cHardwareOrchid::Inst_Trigger9(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpTrigger(9)); }
- 
- bool cHardwareOrchid::Inst_Trigger10(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpTrigger(10)); }
- 
- bool cHardwareOrchid::Inst_Trigger11(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpTrigger(11)); }
- 
- bool cHardwareOrchid::Inst_Guard0(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpGuard(0)); }
- 
- bool cHardwareOrchid::Inst_Guard1(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpGuard(1)); }
- 
- bool cHardwareOrchid::Inst_Guard2(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpGuard(2)); }
- 
- bool cHardwareOrchid::Inst_Guard3(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpGuard(3)); }
- 
- bool cHardwareOrchid::Inst_Guard4(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpGuard(4)); }
- 
- bool cHardwareOrchid::Inst_Action0(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpAction(0)); }
- 
- bool cHardwareOrchid::Inst_Action1(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpAction(1)); }
- 
- bool cHardwareOrchid::Inst_Action2(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpAction(2)); }
- 
- bool cHardwareOrchid::Inst_Action3(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpAction(3)); }
- 
- bool cHardwareOrchid::Inst_Action4(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpAction(4)); }
- 
- bool cHardwareOrchid::Inst_Action5(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpAction(5)); }
- 
- bool cHardwareOrchid::Inst_Action6(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpAction(6)); }
- 
- bool cHardwareOrchid::Inst_Action7(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpAction(7)); }
- 
- bool cHardwareOrchid::Inst_Action8(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpAction(8)); }
- 
- bool cHardwareOrchid::Inst_Action9(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpAction(9)); }
- 
- bool cHardwareOrchid::Inst_Action10(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpAction(10)); }
- 
- bool cHardwareOrchid::Inst_Action11(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpAction(11)); }
- 
- bool cHardwareOrchid::Inst_Action12(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpAction(12)); }
- 
- bool cHardwareOrchid::Inst_Action13(cAvidaContext& ctx)
- { return (organism->GetStateDiagram()->AbsoluteJumpAction(13)); }
- 
+bool cHardwareOrchid::Inst_Trigger1(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTrigger(1)); }
 
+bool cHardwareOrchid::Inst_Trigger2(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTrigger(2)); }
+
+bool cHardwareOrchid::Inst_Trigger3(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTrigger(3)); }
+
+bool cHardwareOrchid::Inst_Trigger4(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTrigger(4)); }
+
+bool cHardwareOrchid::Inst_Trigger5(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTrigger(5)); }
+
+bool cHardwareOrchid::Inst_Trigger6(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTrigger(6)); }
+
+bool cHardwareOrchid::Inst_Trigger7(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTrigger(7)); }
+
+bool cHardwareOrchid::Inst_Trigger8(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTrigger(8)); }
+
+bool cHardwareOrchid::Inst_Trigger9(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTrigger(9)); }
+
+bool cHardwareOrchid::Inst_Trigger10(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTrigger(10)); }
+
+bool cHardwareOrchid::Inst_Trigger11(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTrigger(11)); }
+
+bool cHardwareOrchid::Inst_Guard0(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpGuard(0)); }
+
+bool cHardwareOrchid::Inst_Guard1(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpGuard(1)); }
+
+bool cHardwareOrchid::Inst_Guard2(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpGuard(2)); }
+
+bool cHardwareOrchid::Inst_Guard3(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpGuard(3)); }
+
+bool cHardwareOrchid::Inst_Guard4(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpGuard(4)); }
+
+bool cHardwareOrchid::Inst_Action0(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(0)); }
+
+bool cHardwareOrchid::Inst_Action1(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(1)); }
+
+bool cHardwareOrchid::Inst_Action2(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(2)); }
+
+bool cHardwareOrchid::Inst_Action3(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(3)); }
+
+bool cHardwareOrchid::Inst_Action4(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(4)); }
+
+bool cHardwareOrchid::Inst_Action5(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(5)); }
+
+bool cHardwareOrchid::Inst_Action6(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(6)); }
+
+bool cHardwareOrchid::Inst_Action7(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(7)); }
+
+bool cHardwareOrchid::Inst_Action8(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(8)); }
+
+bool cHardwareOrchid::Inst_Action9(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(9)); }
+
+bool cHardwareOrchid::Inst_Action10(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(10)); }
+
+bool cHardwareOrchid::Inst_Action11(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(11)); }
+
+bool cHardwareOrchid::Inst_Action12(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(12)); }
+
+bool cHardwareOrchid::Inst_Action13(cAvidaContext& ctx)
+{ return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(13)); }
+
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_RelativeMoveTrigger(cAvidaContext& ctx) 
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetStateDiagram()->RelativeJumpTrigger(jump_amount));
+	return (organism->GetOrchidOrganism()->GetStateDiagram()->RelativeJumpTrigger(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_AbsoluteMoveTrigger(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetStateDiagram()->AbsoluteJumpTrigger(jump_amount));
+	return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTrigger(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_NextTrigger(cAvidaContext& ctx)
 {
-	return (organism->GetStateDiagram()->RelativeJumpTrigger(1));
+	return (organism->GetOrchidOrganism()->GetStateDiagram()->RelativeJumpTrigger(1));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_RelativeMoveGuard(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetStateDiagram()->RelativeJumpGuard(jump_amount));
+	return (organism->GetOrchidOrganism()->GetStateDiagram()->RelativeJumpGuard(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_AbsoluteMoveGuard(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetStateDiagram()->AbsoluteJumpGuard(jump_amount));
+	return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpGuard(jump_amount));
 }
 
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_NextGuard(cAvidaContext& ctx)
-{
-	return (organism->GetStateDiagram()->RelativeJumpGuard(1));
-}
+{	return (organism->GetOrchidOrganism()->GetStateDiagram()->RelativeJumpGuard(1)); }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_RelativeMoveAction(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetStateDiagram()->RelativeJumpAction(jump_amount));
+	return (organism->GetOrchidOrganism()->GetStateDiagram()->RelativeJumpAction(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_AbsoluteMoveAction(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetStateDiagram()->AbsoluteJumpAction(jump_amount));
+	return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpAction(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_NextAction(cAvidaContext& ctx)
 {
-	return (organism->GetStateDiagram()->RelativeJumpAction(1));
+	return (organism->GetOrchidOrganism()->GetStateDiagram()->RelativeJumpAction(1));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_RelativeMoveOrigin(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetStateDiagram()->RelativeJumpOriginState(jump_amount));
+	return (organism->GetOrchidOrganism()->GetStateDiagram()->RelativeJumpOriginState(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_AbsoluteMoveOrigin(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetStateDiagram()->AbsoluteJumpOriginState(jump_amount));
+	return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpOriginState(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_NextOrigin(cAvidaContext& ctx)
-{
-	return (organism->GetStateDiagram()->RelativeJumpOriginState(1));
-}
+{	return (organism->GetOrchidOrganism()->GetStateDiagram()->RelativeJumpOriginState(1)); }
 
 
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_RelativeMoveDestination(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetStateDiagram()->RelativeJumpDestinationState(jump_amount));
+	return (organism->GetOrchidOrganism()->GetStateDiagram()->RelativeJumpDestinationState(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_AbsoluteMoveDestination(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetStateDiagram()->AbsoluteJumpDestinationState(jump_amount));
+	return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpDestinationState(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_NextDestination(cAvidaContext& ctx)
-{
-	return (organism->GetStateDiagram()->RelativeJumpDestinationState(1));
-}
+{	return (organism->GetOrchidOrganism()->GetStateDiagram()->RelativeJumpDestinationState(1)); }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_RelativeMoveTransLabel(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetStateDiagram()->RelativeJumpTransitionLabel(jump_amount));
+	return (organism->GetOrchidOrganism()->GetStateDiagram()->RelativeJumpTransitionLabel(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_AbsoluteMoveTransLabel(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetStateDiagram()->AbsoluteJumpTransitionLabel(jump_amount));
+	return (organism->GetOrchidOrganism()->GetStateDiagram()->AbsoluteJumpTransitionLabel(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_NextTransLabel(cAvidaContext& ctx)
-{
-	return (organism->GetStateDiagram()->RelativeJumpTransitionLabel(1));
-}
+{	return (organism->GetOrchidOrganism()->GetStateDiagram()->RelativeJumpTransitionLabel(1)); }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_AbsenceProperty(cAvidaContext& ctx)
 { 
 	float val = 0;
 	// Call a function on the model to create this property.
 	// Currently it just uses p
-	cMDEPropertyGenerator* pg = organism->GetUMLModel()->GetPropertyGenerator();
-	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().GetUMLModel()->GetPropertyGenerator();
+	cMDEPropertyGenerator* pg = organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator();
+	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().GetOrchidPopulation()->GetUMLModel()->GetPropertyGenerator();
 	
 	val = pop_pg->AddAbsenceProperty(pg->GetP());
 	pg->AddPropertyReward(val);
@@ -7265,13 +7306,16 @@
 	return val;
 } 
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_UniversialityProperty(cAvidaContext& ctx) 
 { 
 	float val = 0;
 	// Call a function on the model to create this property.
 	// Currently it just uses p
-	cMDEPropertyGenerator* pg = organism->GetUMLModel()->GetPropertyGenerator();
-	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().GetUMLModel()->GetPropertyGenerator();
+	cMDEPropertyGenerator* pg = organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator();
+	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().GetOrchidPopulation()->GetUMLModel()->GetPropertyGenerator();
 	
 	
 	val = pop_pg->AddUniversalProperty(pg->GetP());
@@ -7282,30 +7326,33 @@
 	return val;
 } 
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_ExistenceProperty(cAvidaContext& ctx)
 {
 	float val = 0;
 	// Call a function on the model to create this property.
 	// Currently it just uses p
-	cMDEPropertyGenerator* pg = organism->GetUMLModel()->GetPropertyGenerator();
-	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().GetUMLModel()->GetPropertyGenerator();
+	cMDEPropertyGenerator* pg = organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator();
+	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().GetOrchidPopulation()->GetUMLModel()->GetPropertyGenerator();
 	
-	
 	val = pop_pg->AddExistenceProperty(pg->GetP());
 	pg->AddPropertyReward(val);
-	if (val) m_world->GetStats().newProperty();
+	if (val) m_world->GetStats().newProperty();  
   
-  
 	return val;
 } 
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_PrecedenceProperty(cAvidaContext& ctx)
 {
 	float val = 0;
-	cMDEPropertyGenerator* pg = organism->GetUMLModel()->GetPropertyGenerator();
-	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().GetUMLModel()->GetPropertyGenerator();
+	cMDEPropertyGenerator* pg = organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator();
+	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().GetOrchidPopulation()->GetUMLModel()->GetPropertyGenerator();
 	
-	
 	val = pop_pg->AddPrecedenceProperty(pg->GetP(), pg->GetQ());
 	pg->AddPropertyReward(val);
 	if (val) m_world->GetStats().newProperty();
@@ -7313,11 +7360,14 @@
 	return val;
 } 
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_ResponseProperty(cAvidaContext& ctx)
 {
 	float val = 0;
-	cMDEPropertyGenerator* pg = organism->GetUMLModel()->GetPropertyGenerator();
-	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().GetUMLModel()->GetPropertyGenerator();
+	cMDEPropertyGenerator* pg = organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator();
+	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().GetOrchidPopulation()->GetUMLModel()->GetPropertyGenerator();
 	
 	val = pop_pg->AddResponseProperty(pg->GetP(), pg->GetQ());
 	pg->AddPropertyReward(val);
@@ -7326,100 +7376,136 @@
 	return val;
 } 
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_RelativeMoveExpressionP(cAvidaContext& ctx) 
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionP(jump_amount));
+	return (organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionP(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_NextExpressionP(cAvidaContext& ctx)
-{
-	return (organism->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionP(1));
-}
+{	return (organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionP(1)); }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_PrevExpressionP(cAvidaContext& ctx)
-{
-	return (organism->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionP(-1));
-}
+{	return (organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionP(-1)); }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_AbsoluteMoveExpressionP(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetUMLModel()->GetPropertyGenerator()->AbsoluteMoveExpressionP(jump_amount));
+	return (organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator()->AbsoluteMoveExpressionP(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_RelativeMoveExpressionQ(cAvidaContext& ctx) 
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionQ(jump_amount));
+	return (organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionQ(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_NextExpressionQ(cAvidaContext& ctx)
-{
-	return (organism->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionQ(1));
-}
+{	return (organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionQ(1)); }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_PrevExpressionQ(cAvidaContext& ctx)
-{
-	return (organism->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionQ(-1));
-}
+{	return (organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionQ(-1)); }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_AbsoluteMoveExpressionQ(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetUMLModel()->GetPropertyGenerator()->AbsoluteMoveExpressionQ(jump_amount));
+	return (organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator()->AbsoluteMoveExpressionQ(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_RelativeMoveExpressionR(cAvidaContext& ctx) 
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionR(jump_amount));
+	return (organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionR(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_NextExpressionR(cAvidaContext& ctx)
-{
-	return (organism->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionR(1));
-}
+{	return (organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionR(1)); }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_PrevExpressionR(cAvidaContext& ctx)
-{
-	return (organism->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionR(-1));
-}
+{	return (organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator()->RelativeMoveExpressionR(-1)); }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_AbsoluteMoveExpressionR(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->GetUMLModel()->GetPropertyGenerator()->AbsoluteMoveExpressionR(jump_amount));
+	return (organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator()->AbsoluteMoveExpressionR(jump_amount));
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_ANDExpressions(cAvidaContext& ctx)
 {	
-	bool val = organism->GetUMLModel()->GetPropertyGenerator()->ANDExpressions();
+	bool val = organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator()->ANDExpressions();
 	if (val) m_world->GetStats().newProposition();	
 	return val;
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_ORExpressions(cAvidaContext& ctx)
 {
-	bool val = organism->GetUMLModel()->GetPropertyGenerator()->ORExpressions();
+	bool val = organism->GetOrchidOrganism()->GetUMLModel()->GetPropertyGenerator()->ORExpressions();
 	if (val) m_world->GetStats().newProposition();	
 	return val;
 }
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_StartLoop(cAvidaContext& ctx)
 {
-	organism->GetStateDiagram()->StartLooping();
+	organism->GetOrchidOrganism()->GetStateDiagram()->StartLooping();
 	return true;
 }  
 
+
+/*! This instruction...
+ */
 bool cHardwareOrchid::Inst_EndLoop(cAvidaContext& ctx)
 {
-	organism->GetStateDiagram()->EndLooping();
+	organism->GetOrchidOrganism()->GetStateDiagram()->EndLooping();
 	return true;
 } 

Modified: branches/uml-merge/source/main/cAvidaConfig.h
===================================================================
--- branches/uml-merge/source/main/cAvidaConfig.h	2008-06-24 18:01:14 UTC (rev 2684)
+++ branches/uml-merge/source/main/cAvidaConfig.h	2008-06-25 14:04:41 UTC (rev 2685)
@@ -294,7 +294,6 @@
   CONFIG_ADD_VAR(ANALYZE_FILE, cString, "analyze.cfg", "File used for analysis mode");
   CONFIG_ADD_VAR(ENVIRONMENT_FILE, cString, "environment.cfg", "File that describes the environment");
   CONFIG_ADD_VAR(START_CREATURE, cString, "default-classic.org", "Organism to seed the soup");
-  CONFIG_ADD_VAR(SEED_MODEL, cString, "seed-model.cfg", "UML configuration file.");
   
   CONFIG_ADD_GROUP(DEME_GROUP, "Demes and Germlines");
   CONFIG_ADD_VAR(NUM_DEMES, int, 1, "Number of independent groups in the\npopulation (default=1).");
@@ -555,6 +554,11 @@
   CONFIG_ADD_CUSTOM_FORMAT(INST_SET_NEW, "Instruction Set Definition");
   CONFIG_ADD_FORMAT_VAR(INST, "Instruction entry in the instruction set");
   
+  // -------- Orchid settings --------
+  CONFIG_ADD_GROUP(ORCHID_GROUP, "Orchid settings");
+  CONFIG_ADD_VAR(ENABLE_ORCHID, bool, 0, "Enable the Orchid subsystem, 0==off (default), 1==on.");
+  CONFIG_ADD_VAR(ORCHID_SEED_MODEL, cString, "seed-model.cfg", "UML configuration file.");
+  
 #endif
   
   void Load(const cString& filename, const bool& crash_if_not_found);

Modified: branches/uml-merge/source/main/cBirthChamber.cc
===================================================================
--- branches/uml-merge/source/main/cBirthChamber.cc	2008-06-24 18:01:14 UTC (rev 2684)
+++ branches/uml-merge/source/main/cBirthChamber.cc	2008-06-25 14:04:41 UTC (rev 2685)
@@ -32,6 +32,7 @@
 #include "cGenome.h"
 #include "cGenomeUtil.h"
 #include "cGenotype.h"
+#include "cOrchidFactory.h"
 #include "cOrganism.h"
 #include "cTools.h"
 #include "cWorld.h"
@@ -181,10 +182,10 @@
     
   child_genotype->IncDeferAdjust();
 
-  // For orchid -- provides the offspring with information about its parent's model.
-  child_array[0]->SetParentXMI(parent.GetUMLModel()->GetXMI());
-  child_array[0]->SetParentBonus(parent.GetParentBonus());  
-  child_array[0]->SetParentScenarioCompletion(parent.GetUMLModel()->GetScenarioCompletion());
+  // If we're using Orchid, we have to build that facet of the organism:
+  if(m_world->GetConfig().ENABLE_ORCHID.Get()) {
+    child_array[0]->SetOrchidOrganism(cOrchidFactory::BuildOrchidOrganism(parent.GetOrchidOrganism()));
+  }
 
   return true;
 }

Modified: branches/uml-merge/source/main/cOrganism.cc
===================================================================
--- branches/uml-merge/source/main/cOrganism.cc	2008-06-24 18:01:14 UTC (rev 2684)
+++ branches/uml-merge/source/main/cOrganism.cc	2008-06-25 14:04:41 UTC (rev 2685)
@@ -36,6 +36,7 @@
 #include "cHardwareManager.h"
 #include "cInjectGenotype.h"
 #include "cInstSet.h"
+#include "cOrchidOrganism.h"
 #include "cOrgSinkMessage.h"
 #include "cPopulationCell.h"
 #include "cPopulation.h"
@@ -103,8 +104,9 @@
   assert(m_is_running == false);
   delete m_hardware;
   delete m_interface;
-  if (m_net != NULL) delete m_net;
-  if(!m_msg) delete m_msg;
+  if(m_net != NULL) delete m_net;
+  if(m_msg) delete m_msg;
+  if(m_orchid) delete m_orchid;  
 }
 
 cOrganism::cNetSupport::~cNetSupport()
@@ -692,127 +694,3 @@
   // move IP to alarm_label
   m_hardware->Jump_To_Alarm_Label(jump_label);
 }
-
-
-// -------- Orchid support --------
-
-/*! Default constructor for Orchid support.  Initialize all Orchid-related variables
- that are specific to this organism.
- */
-cOrganism::cOrchidSupport::cOrchidSupport(cWorld* world)
-: m_state_diag(0)
-, m_orig_state_index(0)
-, m_dest_state_index(0)
-, m_model((const char*)world->GetConfig().SEED_MODEL.Get())
-{
-}
-
-
-/*! Model check this organism... (more)
- */
-void cOrganism::ModelCheck(cAvidaContext& ctx)
-{
-	if(GetCellID()==-1) return;
-  InitOrchid();
-  
-	if(m_orchid->m_model.GetGenMode() == 0) {
-		m_orchid->m_model.PrintXMI();	
-		// Update the value of max trans
-		if(m_orchid->m_model.NumTrans() > m_orchid->m_model.GetMaxTrans()) { 
-      m_orchid->m_model.SetMaxTrans(m_orchid->m_model.NumTrans());
-		} 
-	}
-	
-  DoOutput(ctx, true);
-  
-	cUMLModel* org_model = GetUMLModel();
-	cUMLModel* pop_model = m_world->GetPopulation().GetUMLModel();
-	m_world->GetStats().OrchidStatsPostTaskCheck(org_model, pop_model);
-	m_orchid->m_model.GetPropertyGenerator()->ResetPropertyReward();
-}
-
-
-cUMLModel* cOrganism::GetUMLModel()
-{
-  InitOrchid();
-  return &m_orchid->m_model;
-}
-
-
-bool cOrganism::AbsoluteJumpStateDiagram(int amount)
-{
-  InitOrchid();
-	m_orchid->m_state_diag = 0;
-	return RelativeJumpStateDiagram(amount);
-}
-
-
-bool cOrganism::RelativeJumpStateDiagram(int amount)
-{
-  InitOrchid();
-	int size = GetUMLModel()->GetStateDiagramSize();
-	
-	if(size == 0) {
-		return false;
-	}
-	
-	if(size > 0) { 
-		m_orchid->m_state_diag += (amount % size);
-    
-		// index is greater than vector
-		if(m_orchid->m_state_diag >= size) { 
-			m_orchid->m_state_diag -= size;
-		} else if(m_orchid->m_state_diag < 0) { 
-			m_orchid->m_state_diag += size;
-		}
-	}	
-  
-	return true;
-}
-
-
-cUMLStateDiagram* cOrganism::GetStateDiagram() 
-{ 
-  InitOrchid();
-  return m_orchid->m_model.GetStateDiagram(m_orchid->m_state_diag);
-}
-
-
-bool cOrganism::AbsoluteJumpOriginState(int amount)
-{
-  InitOrchid();
-	m_orchid->m_orig_state_index = 0;
-	return (RelativeJumpOriginState(amount));
-}
-
-
-bool cOrganism::AbsoluteJumpDestinationState(int amount)
-{
-  InitOrchid();
-	m_orchid->m_dest_state_index = 0;
-	return (RelativeJumpDestinationState(amount));
-}
-
-
-bool cOrganism::AddTransitionTotal() 
-{
-  InitOrchid();
-	bool val;
-	val = GetStateDiagram()->AddTransitionTotal();	
-	return val;
-}
-
-bool cOrganism::RelativeJumpOriginState(int amount) 
-{ 
-  InitOrchid();
-	m_orchid->m_orig_state_index += amount; 
-	return true;
-}
-
-bool cOrganism::RelativeJumpDestinationState(int amount) 
-{ 
-  InitOrchid();
-	m_orchid->m_dest_state_index += amount; 
-	return true;
-}
-

Modified: branches/uml-merge/source/main/cOrganism.h
===================================================================
--- branches/uml-merge/source/main/cOrganism.h	2008-06-24 18:01:14 UTC (rev 2684)
+++ branches/uml-merge/source/main/cOrganism.h	2008-06-25 14:04:41 UTC (rev 2685)
@@ -72,12 +72,6 @@
 #ifndef tSmartArray_h
 #include "tSmartArray.h"
 #endif
-#ifndef _C_UMLMODEL_H_
-#include "cUMLModel.h"
-#endif
-#ifndef _C_UMLSTATEDIAGRAM_H_
-#include "cUMLStateDiagram.h"
-#endif
 
 
 class cAvidaContext;
@@ -87,6 +81,7 @@
 class cHardwareBase;
 class cInjectGenotype;
 class cLineage;
+class cOrchidOrganism;
 class cOrgSinkMessage;
 class cSaleItem;
 
@@ -401,63 +396,13 @@
 
   // -------- Orchid support --------
 public:
-  //!
-  void ModelCheck(cAvidaContext& ctx);
-  //!
-  cUMLModel* GetUMLModel();
-  //! Return the XMI string for the model generated by this organism's parent.
-  const std::string& GetParentXMI() { InitOrchid(); return m_orchid->m_parent_xmi; }
-  //!
-  int GetStateDiagramIndex() { InitOrchid(); return m_orchid->m_state_diag; } 
-  //! (use meaningful names for parameters)
-  bool CurrTrans (int, int, int, int, int, int); 
-  //! 
-  cUMLStateDiagram* GetStateDiagram();
-  //! consider const std::string& (parameter name)
-  void SetParentXMI(const std::string& xmi) { InitOrchid(); m_orchid->m_parent_xmi = xmi; } 
-  //!
-  void SetParentBonus(const std::map<std::string,float>& parent_bonus) { InitOrchid(); m_orchid->m_parent_bonus = parent_bonus; }
-  //! (names) 
-  float GetParentBonus(const std::string& s) { InitOrchid(); return m_orchid->m_parent_bonus[s]; }
-  //! Returns the bonus map for this organism's parent.
-  const std::map<std::string, float>& GetParentBonus() { InitOrchid(); return m_orchid->m_parent_bonus; }
-  //! Returns a vector for scenario completion of this organism's parent.
-  const std::vector<double>& GetParentScenarioCompletion() { InitOrchid(); return m_orchid->m_parent_scenario_completion; } 
-  //! (names)
-  void SetParentScenarioCompletion (const std::vector<double>& s) { InitOrchid(); m_orchid->m_parent_scenario_completion = s; }
- 
-  // The jump functions jump the index of the various vectors either forward (+ int) or backwards (- int)
-  bool AbsoluteJumpOriginState(int);
-  bool AbsoluteJumpDestinationState(int);
-  bool AbsoluteJumpStateDiagram (int);
-  bool RelativeJumpOriginState(int amount);
-  bool RelativeJumpDestinationState(int amount);
-  bool RelativeJumpStateDiagram (int); 
-  bool AddTransitionTotal();
-
-protected:
-  /*! Contains all the different data structures needed to support Orchid-related
-   functionality.  Inspired by cMessagingSupport (above), the idea is to minimize 
-   impact when not running Orchid experiments. */
-  struct cOrchidSupport
-  {
-    //! Default constructor.
-    cOrchidSupport(cWorld* world);
-    int m_state_diag; //!< Index of the state diagram currently being manipulated.
-    int m_orig_state_index; //!<
-    int m_dest_state_index; //!<
-    cUMLModel m_model; //!<
-    std::string m_parent_xmi; //!<
-    std::map<std::string, float> m_parent_bonus; //!<
-    std::vector<double> m_parent_scenario_completion; //!<
-  };
+  //! Return this organism's Orchid facet.
+  cOrchidOrganism* GetOrchidOrganism() { return m_orchid; }
+  //! Set this organism's Orchid facet.
+  void SetOrchidOrganism(cOrchidOrganism* orchid) { m_orchid = orchid; }
   
-  /*! This member variable is lazily initialized whenever any of the messaging
-   methods are used.  (My kingdom for boost::shared_ptr.) */
-  cOrchidSupport* m_orchid;
-  
-  //! Called to check for (and initialize) orchid support within this organism.
-  inline void InitOrchid() { if(!m_orchid) m_orchid = new cOrchidSupport(m_world); }
+protected:
+  cOrchidOrganism* m_orchid; //!< This organism's Orchid facet; null if not using Orchid.
   //-------- End of Orchid support --------  
 };
 

Modified: branches/uml-merge/source/main/cPopulation.cc
===================================================================
--- branches/uml-merge/source/main/cPopulation.cc	2008-06-24 18:01:14 UTC (rev 2684)
+++ branches/uml-merge/source/main/cPopulation.cc	2008-06-25 14:04:41 UTC (rev 2685)
@@ -45,6 +45,8 @@
 #include "cInstSet.h"
 #include "cIntegratedSchedule.h"
 #include "cLineage.h"
+#include "cOrchidFactory.h"
+#include "cOrchidPopulation.h"
 #include "cOrganism.h"
 #include "cPhenotype.h"
 #include "cPopulationCell.h"
@@ -81,7 +83,7 @@
 , environment(world->GetEnvironment())
 , num_organisms(0)
 , sync_events(false)
-, m_model((const char*)world->GetConfig().SEED_MODEL.Get())
+, m_orchid(0)
 {
   // Avida specific information.
   world_x = world->GetConfig().WORLD_X.Get();
@@ -249,6 +251,12 @@
     }
   }
   
+  // Now we're going to check to see if we should initialize Orchid.
+  // Although Orchid does not currently utilize demes, the expectation is that
+  // each deme could support its own cOrchidPopulationInterface.
+  if(m_world->GetConfig().ENABLE_ORCHID.Get()) {
+    m_orchid = cOrchidFactory::BuildOrchidPopulation(m_world);
+  }
 }
 
 void cPopulation::InitiatePop() {
@@ -281,6 +289,7 @@
 {
   for (int i = 0; i < cell_array.GetSize(); i++) KillOrganism(cell_array[i]);
   delete schedule;
+  if(m_orchid) delete m_orchid;
 }
 
 

Modified: branches/uml-merge/source/main/cPopulation.h
===================================================================
--- branches/uml-merge/source/main/cPopulation.h	2008-06-24 18:01:14 UTC (rev 2684)
+++ branches/uml-merge/source/main/cPopulation.h	2008-06-25 14:04:41 UTC (rev 2685)
@@ -74,6 +74,7 @@
 class cGenome;
 class cGenotype;
 class cLineage;
+class cOrchidPopulation;
 class cOrganism;
 class cPopulationCell;
 class cSchedule;
@@ -317,6 +318,15 @@
   
   // Let users change environmental variables durning the run @BDB 22-Feb-2008
   void UpdateResourceCount(const int Verbosity);
+  
+  // -------- Orchid support --------
+public:
+  //! Return this population's interface to Orchid.
+  cOrchidPopulation* GetOrchidPopulation() { return m_orchid; }
+  
+protected:
+  cOrchidPopulation* m_orchid; //!< This population's interface to Orchid.
+  // -------- End of Orchid support --------
 };
 
 

Modified: branches/uml-merge/source/main/cStats.cc
===================================================================
--- branches/uml-merge/source/main/cStats.cc	2008-06-24 18:01:14 UTC (rev 2684)
+++ branches/uml-merge/source/main/cStats.cc	2008-06-25 14:04:41 UTC (rev 2685)
@@ -40,6 +40,7 @@
 #include "cOrgMessagePredicate.h"
 #include "cOrgMovementPredicate.h"
 #include "cReaction.h"
+#include "cUMLModel.h"
 
 #include "functions.h"
 

Modified: branches/uml-merge/source/main/cStats.h
===================================================================
--- branches/uml-merge/source/main/cStats.h	2008-06-24 18:01:14 UTC (rev 2684)
+++ branches/uml-merge/source/main/cStats.h	2008-06-25 14:04:41 UTC (rev 2685)
@@ -887,6 +887,7 @@
   void respPropFailure(int x) {m_respPropertyFailure =x;}
   void respPropTotal(int x)  {m_respPropertyTotal =x;}
   void suppressedTotal(int x) { m_suppressed = x; }*/
+  
   void addScenarioCompletion(std::vector<double>);
   void OrchidStatsPostTaskCheck(cUMLModel*, cUMLModel*);
   int GetPropTotal () { return m_propertyTotal; }

Modified: branches/uml-merge/source/main/cTaskLib.cc
===================================================================
--- branches/uml-merge/source/main/cTaskLib.cc	2008-06-24 18:01:14 UTC (rev 2684)
+++ branches/uml-merge/source/main/cTaskLib.cc	2008-06-25 14:04:41 UTC (rev 2685)
@@ -33,6 +33,7 @@
 #include "cTaskState.h"
 #include "cPopulation.h"
 #include "cPopulationCell.h"
+#include "cOrchidOrganism.h"
 #include "cOrgMessagePredicate.h"
 #include "cOrgMovementPredicate.h"
 
@@ -3061,79 +3062,73 @@
 }
 
 
-//-------- Orchid tasks --------
+/*! This task...
+ */
 double cTaskLib::Task_Scenarios(cTaskContext& ctx) const
 {
+  cOrchidOrganism* orchid_org = ctx.GetOrganism()->GetOrchidOrganism();
+  assert(orchid_org);
 	double bonus = 0.0; 
-//	double temp_bonus = 0;
 	std::string sc_name;
-	cOrganism* org = ctx.GetOrganism();
 	
-	// Check if this model is different than the organism's parent's model
-	if (org->GetParentXMI() != org->GetUMLModel()->GetXMI()) {
-		bonus = org->GetUMLModel()->checkForScenarios();
+	// Check if this model is different than the orchid_organism's parent's model
+	if (orchid_org->GetParentXMI() != orchid_org->GetUMLModel()->GetXMI()) {
+		bonus = orchid_org->GetUMLModel()->checkForScenarios();
 	} else { 
-		bonus = org->GetParentBonus("scenarios"); 
-		org->GetUMLModel()->SetScenarioCompletion(org->GetParentScenarioCompletion());
+		bonus = orchid_org->GetParentBonus("scenarios"); 
+		orchid_org->GetUMLModel()->SetScenarioCompletion(orchid_org->GetParentScenarioCompletion());
 	}
 	
 	// Set bonus info for current model
-	org->GetUMLModel()->SetBonusInfo("scenarios", bonus);		
-	
-	m_world->GetStats().addScenarioCompletion(org->GetUMLModel()->GetScenarioCompletion());
-	
-	return bonus;
+	orchid_org->GetUMLModel()->SetBonusInfo("scenarios", bonus);		
+	m_world->GetStats().addScenarioCompletion(orchid_org->GetUMLModel()->GetScenarioCompletion());
+  return bonus;
 }
 
+
+/*! This task...
+ */
 double cTaskLib::Task_Properties(cTaskContext& ctx) const
 {
+  cOrchidOrganism* orchid_org = ctx.GetOrganism()->GetOrchidOrganism();
+  assert(orchid_org);
 	double bonus = 0.0; 
-	cOrganism* org = ctx.GetOrganism();
-	//cPopulation* pop = (&m_world->GetPopulation());
 	
 	// call some sort of check properties function for the model.
-	bonus =  org->GetUMLModel()->GetPropertyGenerator()->GetPropertyReward();
+	bonus =  orchid_org->GetUMLModel()->GetPropertyGenerator()->GetPropertyReward();
 	//pop->GetUMLModel()->checkProperties();
 	//m_world->GetStats().propSuccess(pop->GetUMLModel()->numSuccess());
 	//m_world->GetStats().propFailure(pop->GetUMLModel()->numFailure());
-	
-	return bonus;
-	
+	return bonus;	
 }
 
 
-
+/*! This task...
+ */
 double cTaskLib::Task_Hydra(cTaskContext& ctx) const
 {
-	cOrganism* organism = ctx.GetOrganism();
-	std::string temp;
-	double bonus = 0.0;
-
-
-	temp = organism->GetUMLModel()->GetXMI();
+  cOrchidOrganism* orchid_org = ctx.GetOrganism()->GetOrchidOrganism();
+  assert(orchid_org);
+	double bonus = 0.0; 
+	std::string temp = orchid_org->GetUMLModel()->GetXMI();
 	
 	// call hydra when a // all scenario hits its max?
 	// all are non-zero?
-	if (!organism->GetUMLModel()->ReadyForHydra()) {
-		
-		organism->GetUMLModel()->SetBonusInfo("hydra", bonus);
-		
+	if (!orchid_org->GetUMLModel()->ReadyForHydra()) {
+		orchid_org->GetUMLModel()->SetBonusInfo("hydra", bonus);
 		return 0;
 	}
 		
 	m_world->GetStats().HydraAttempt();
 
-	if (organism->GetParentXMI() == temp) {
-	
-		bonus = organism->GetParentBonus("hydra"); 
-		organism->GetUMLModel()->SetBonusInfo("hydra", bonus);	
+	if (orchid_org->GetParentXMI() == temp) {
+		bonus = orchid_org->GetParentBonus("hydra"); 
+		orchid_org->GetUMLModel()->SetBonusInfo("hydra", bonus);	
 		return bonus;
 	}		
 
-
 	unsigned int status_total = 0;
 	int status=0;
-
 	int to_subavida[2]={0};
 	int from_subavida[2]={0};
 	
@@ -3145,6 +3140,7 @@
     std::cerr << "ERROR: fork failed; errno=" << errno << std::endl;
     assert(false);
   }
+
 	if(subavida == 0) {
 		//child
 		close(to_subavida[1]);
@@ -3156,7 +3152,8 @@
     std::cerr << "ERROR: execl failed; errno=" << errno << std::endl;
     assert(false);
 	} 
-	//parent
+	
+  //parent
 	close(to_subavida[0]);
 	close(from_subavida[1]);
 
@@ -3209,31 +3206,26 @@
 		bonus = 1.0;
 	}
 	
-	organism->GetUMLModel()->SetBonusInfo("hydra", bonus);	
-	return bonus;
-	
+	orchid_org->GetUMLModel()->SetBonusInfo("hydra", bonus);	
+	return bonus;	
 }
 
 
+/*! This task...
+ */
 double cTaskLib::SpinCoprocess(cTaskContext& ctx, const std::string& neverclaimFile) const {
-//	cOrganism* organism = ctx.GetOrganism();
-	
 	std::string file_name = "tmp-" + neverclaimFile + ".pr";
 	std::string cmd = "cp tmp.pr "+ file_name;
 	if(system(cmd.c_str())!=0) return 0.0;
-	
-
-//	std::string cmd = "cat " + neverclaimFile + " >> tmp.pr && ./spin -a tmp.pr &> /dev/null";
+  //std::string cmd = "cat " + neverclaimFile + " >> tmp.pr && ./spin -a tmp.pr &> /dev/null";
 	cmd = "cat " + neverclaimFile + " >> " + file_name + " && ./spin -a " +  file_name + " &> /dev/null";
 	if(system(cmd.c_str())!=0) return 0.0;
-	
 	if(system("/usr/bin/gcc -DMEMLIM=512 pan.c -o pan &> /dev/null")!=0) return 0.0;
 	if(system("./pan -a &> ./pan.out")!=0) return 0.0;
 	if(system("cat pan.out | perl -e 'while(<STDIN>) { if(/errors:\\s(\\d+)/) {exit($1);}}'")!=0) return 0.0;
-//	if(system("cat pan.out | perl -e 'while(<STDIN>) { if(/unreached/) {exit(1);}}'")!=0) return 0.2;
+  //if(system("cat pan.out | perl -e 'while(<STDIN>) { if(/unreached/) {exit(1);}}'")!=0) return 0.2;
 
-
-// Commented out to remove overhead...	
+  //Commented out to remove overhead...	
 	std::ostringstream strstrm, strstrm2; 
 	strstrm << "cp tmp.xmi "  << neverclaimFile << "." << m_world->GetStats().GetUpdate() << "." << ctx.GetOrganism()->GetID();
 	strstrm << ".xml";	
@@ -3241,15 +3233,16 @@
 	
 	strstrm2 << neverclaimFile << "." << m_world->GetStats().GetUpdate() << "." << ctx.GetOrganism()->GetID();
 	// print the relevant information about the scenarios
-//	std::string temp_str = neverclaimFile + "." + m_world->GetStats().GetUpdate() + "."; // + ctx.GetOrganism()->GetID();
-	ctx.GetOrganism()->GetUMLModel()->PrintScenarioUtility(strstrm2.str().c_str());
-			
+  //std::string temp_str = neverclaimFile + "." + m_world->GetStats().GetUpdate() + "."; // + ctx.GetOrganism()->GetID();
+	ctx.GetOrganism()->GetOrchidOrganism()->GetUMLModel()->PrintScenarioUtility(strstrm2.str().c_str());
 	return 1.0;
 }
  
+
+/*! This task...
+ */
 double cTaskLib::SpinWitnessCoprocess(cTaskContext& ctx, const std::string& neverclaimFile) const {
 	int num_witness = 0;
-//	const int max_witness = 1;
 	
 	std::string file_name = "tmp-witness" + neverclaimFile + ".pr";
 	std::string cmd = "cp tmp.pr "+ file_name;
@@ -3270,163 +3263,150 @@
 		//(system("cat pan.out | perl -e 'while(<STDIN>) { if(/errors:\\s(\\d+)/) {exit($1);}}'"));
 }
 
+
+/*! This task...
+ */
 double cTaskLib::Task_SpinN1(cTaskContext& ctx) const {
-	cOrganism* organism = ctx.GetOrganism();
-	double bonus = 0.0;
-		
-	/*if (organism->GetUMLModel()->GetBonusInfo("spinw1") <= 1)	
+  cOrchidOrganism* orchid_org = ctx.GetOrganism()->GetOrchidOrganism();
+  assert(orchid_org);
+	double bonus = 0.0; 
+  
+	/*if (orchid_org->GetUMLModel()->GetBonusInfo("spinw1") <= 1)	
 	{ 
-		organism->GetUMLModel()->SetBonusInfo("spinn1", bonus);	
+		orchid_org->GetUMLModel()->SetBonusInfo("spinn1", bonus);	
 		return bonus;
 	}*/
-	if (organism->GetUMLModel()->GetWitnessMode()) {
-		if (organism->GetUMLModel()->GetBonusInfo("spinw1") <  1)	
-		{ 
-			organism->GetUMLModel()->SetBonusInfo("spinn1", bonus);	
+	if(orchid_org->GetUMLModel()->GetWitnessMode()) {
+		if(orchid_org->GetUMLModel()->GetBonusInfo("spinw1") <  1) { 
+			orchid_org->GetUMLModel()->SetBonusInfo("spinn1", bonus);	
 			return bonus;
 		}
 	} else {
-		if (organism->GetUMLModel()->GetBonusInfo("hydra") == 0)
-		{
-			organism->GetUMLModel()->SetBonusInfo("spinn1", bonus);	
+		if(orchid_org->GetUMLModel()->GetBonusInfo("hydra") == 0) {
+			orchid_org->GetUMLModel()->SetBonusInfo("spinn1", bonus);	
 			return bonus;
 		}
 	}
-
 	
 	m_world->GetStats().N1Attempt();
 
-
-	if (organism->GetParentXMI() == organism->GetUMLModel()->GetXMI()) {
-	
-		bonus = organism->GetParentBonus("spinn1"); 
-	}	else {
-	
+	if(orchid_org->GetParentXMI() == orchid_org->GetUMLModel()->GetXMI()) {	
+		bonus = orchid_org->GetParentBonus("spinn1"); 
+	}	else {	
 		bonus = SpinCoprocess(ctx, "N1");
 	}
 	
-	organism->GetUMLModel()->SetBonusInfo("spinn1", bonus);	
+	orchid_org->GetUMLModel()->SetBonusInfo("spinn1", bonus);	
 	if (bonus > 0) 	m_world->GetStats().N1Passed();
-
 	return bonus;
 }
 
 
-
+/*! This task...
+ */
 double cTaskLib::Task_SpinW1(cTaskContext& ctx) const { 
-	cOrganism* organism = ctx.GetOrganism();
-	double bonus = 0.0;
+  cOrchidOrganism* orchid_org = ctx.GetOrganism()->GetOrchidOrganism();
+  assert(orchid_org);
+	double bonus = 0.0; 
 	
-	
-	if	(organism->GetUMLModel()->GetBonusInfo("hydra") == 0)
-	{ 
+	if(orchid_org->GetUMLModel()->GetBonusInfo("hydra") == 0)	{ 
 		return bonus;
 	}
 	
 	m_world->GetStats().W1Attempt();
-
 	
-	if ((organism->GetParentXMI()) == (organism->GetUMLModel()->GetXMI())) {	
-		bonus = organism->GetParentBonus("spinw1"); 
+	if((orchid_org->GetParentXMI()) == (orchid_org->GetUMLModel()->GetXMI())) {	
+		bonus = orchid_org->GetParentBonus("spinw1"); 
 	}	else {
-	
 		bonus = SpinWitnessCoprocess(ctx, "W1");
 	}
 	
-	organism->GetUMLModel()->SetBonusInfo("spinw1", bonus);	
+	orchid_org->GetUMLModel()->SetBonusInfo("spinw1", bonus);	
 	if (bonus > 0) 	m_world->GetStats().W1Passed();
-	
-
 	return bonus;
 }
 
 
+/*! This task...
+ */
 double cTaskLib::Task_SpinN2(cTaskContext& ctx) const {
-	cOrganism* organism = ctx.GetOrganism();
-	double bonus = 0.0;
+  cOrchidOrganism* orchid_org = ctx.GetOrganism()->GetOrchidOrganism();
+  assert(orchid_org);
+	double bonus = 0.0; 
 	
-	if (organism->GetUMLModel()->GetWitnessMode()) {
-		if (organism->GetUMLModel()->GetBonusInfo("spinw2") < 1)	
-		{ 
-			organism->GetUMLModel()->SetBonusInfo("spinn2", bonus);	
+	if(orchid_org->GetUMLModel()->GetWitnessMode()) {
+		if(orchid_org->GetUMLModel()->GetBonusInfo("spinw2") < 1)	{ 
+			orchid_org->GetUMLModel()->SetBonusInfo("spinn2", bonus);	
 			return bonus;
 		}
 	} else {
-		if (organism->GetUMLModel()->GetBonusInfo("hydra") == 0)
-		{
-			organism->GetUMLModel()->SetBonusInfo("spinn2", bonus);	
+		if(orchid_org->GetUMLModel()->GetBonusInfo("hydra") == 0)	{
+			orchid_org->GetUMLModel()->SetBonusInfo("spinn2", bonus);	
 			return bonus;
 		}
 	}
 	
 	m_world->GetStats().N2Attempt();
 
-	
-	if (organism->GetParentXMI() == organism->GetUMLModel()->GetXMI()) {
-	
-		bonus = organism->GetParentBonus("spinn2"); 
+	if(orchid_org->GetParentXMI() == orchid_org->GetUMLModel()->GetXMI()) {
+		bonus = orchid_org->GetParentBonus("spinn2"); 
 	}	else {
-	
 		bonus = SpinCoprocess(ctx, "N2");
 	}
 	
-	organism->GetUMLModel()->SetBonusInfo("spinn2", bonus);	
+	orchid_org->GetUMLModel()->SetBonusInfo("spinn2", bonus);	
 	if (bonus > 0) 	m_world->GetStats().N2Passed();
-
 	return bonus;
 }
 
 
-
+/*! This task...
+ */
 double cTaskLib::Task_SpinW2(cTaskContext& ctx) const { 
-	cOrganism* organism = ctx.GetOrganism();
-	double bonus = 0.0;
-
-	if	(organism->GetUMLModel()->GetBonusInfo("hydra") == 0)	
-	{ 
+  cOrchidOrganism* orchid_org = ctx.GetOrganism()->GetOrchidOrganism();
+  assert(orchid_org);
+	double bonus = 0.0; 
+  
+	if(orchid_org->GetUMLModel()->GetBonusInfo("hydra") == 0)	{ 
 		return bonus;
 	}
-
 	
 	m_world->GetStats().W2Attempt();
 		
-	if (organism->GetParentXMI() == organism->GetUMLModel()->GetXMI()) {	
-		bonus = organism->GetParentBonus("spinw2"); 
+	if(orchid_org->GetParentXMI() == orchid_org->GetUMLModel()->GetXMI()) {
+		bonus = orchid_org->GetParentBonus("spinw2"); 
 	}	else {
-	
 		bonus = SpinWitnessCoprocess(ctx, "W2");
 	}
-
-	organism->GetUMLModel()->SetBonusInfo("spinw2", bonus);	
+  
+	orchid_org->GetUMLModel()->SetBonusInfo("spinw2", bonus);	
 	if (bonus > 0) 	m_world->GetStats().W2Passed();
-
 	return bonus;
 }
 
 
-
-
+/*! This task...
+ */
 double cTaskLib::Task_MinTrans(cTaskContext& ctx) const { 
-	// This task rewards organisms for having fewer edges
-	cOrganism* organism = ctx.GetOrganism();
-	cUMLModel* mod = organism->GetUMLModel();
-	double bonus = 0.0;
+	// This task rewards orchid_orgs for having fewer edges
+  cOrchidOrganism* orchid_org = ctx.GetOrganism()->GetOrchidOrganism();
+  assert(orchid_org);
+	double bonus = 0.0; 
+	cUMLModel* mod = orchid_org->GetUMLModel();
 	int mt, nt;
 		
-		
-/*	if ((organism->GetUMLModel()->GetBonusInfo("spinw1") == 0)	 &&
-		(organism->GetUMLModel()->GetBonusInfo("spinw2") == 0)) { 
-			return bonus;
-	} 
-	if ((organism->GetUMLModel()->GetBonusInfo("scenario5") != 9) || 
-		(organism->GetUMLModel()->GetBonusInfo("scenario6") != 4)) { 
-			return bonus;
-	}*/
-/*	if	(organism->GetUMLModel()->GetBonusInfo("hydra") == 0){ 
+  /*	if ((orchid_org->GetUMLModel()->GetBonusInfo("spinw1") == 0)	 &&
+   (orchid_org->GetUMLModel()->GetBonusInfo("spinw2") == 0)) { 
+   return bonus;
+   } 
+   if ((orchid_org->GetUMLModel()->GetBonusInfo("scenario5") != 9) || 
+   (orchid_org->GetUMLModel()->GetBonusInfo("scenario6") != 4)) { 
+   return bonus;
+   }*/
+  /*	if	(orchid_org->GetUMLModel()->GetBonusInfo("hydra") == 0){ 
 		return bonus;
-	}*/
-
-	
+   }*/
+  
 	// Ok. Subtract the number of edges from the maximum number of edges seen so far. 
 	mt = mod->GetMaxTrans();
 	nt = mod->NumTrans();
@@ -3438,20 +3418,21 @@
 	
 	// cap the amount of bonus.
 	//if (bonus > 5) bonus = 5;
-	
 	return bonus;
-
 }
 
 
+/*! This task...
+ */
 double cTaskLib::Task_Nondeterminism(cTaskContext& ctx) const {
-	cOrganism* organism = ctx.GetOrganism();
+  cOrchidOrganism* orchid_org = ctx.GetOrganism()->GetOrchidOrganism();
+  assert(orchid_org);
+	double bonus = 0.0; 
 	double nd_penalty=0;
 	double max_bonus=0;
-	double bonus; 
 	
-	for(unsigned int i=0; i<organism->GetUMLModel()->GetStateDiagramSize(); ++i, ++max_bonus) {
-		cUMLStateDiagram* sd=organism->GetUMLModel()->GetStateDiagram(i);
+	for(unsigned int i=0; i<orchid_org->GetUMLModel()->GetStateDiagramSize(); ++i, ++max_bonus) {
+		cUMLStateDiagram* sd=orchid_org->GetUMLModel()->GetStateDiagram(i);
 		if(sd->NumStates() > 0) {
 			nd_penalty += sd->GetNumberOfNonDeterministicStates() / sd->NumStates();
 		}
@@ -3461,37 +3442,39 @@
 	
 	if (bonus < 0) bonus = 0;
 	
-	organism->GetUMLModel()->SetBonusInfo("isDeterministic", bonus);	
+	orchid_org->GetUMLModel()->SetBonusInfo("isDeterministic", bonus);	
 	return bonus;
 }
 
-// This task will be used to see if an organism meets the criteria for 
-// running hydra. If so, the task will export the XMI. It is designed to make it possible
-// for the tasks to run on non-class 5 machines.
+
+/*! This task will be used to see if an orchid_org meets the criteria for 
+ running hydra. If so, the task will export the XMI. It is designed to make it possible
+ for the tasks to run on non-class 5 machines.
+ */
 double cTaskLib::Task_ExportXMI(cTaskContext& ctx) const {
-	cOrganism* organism = ctx.GetOrganism();
+  cOrchidOrganism* orchid_org = ctx.GetOrganism()->GetOrchidOrganism();
+  assert(orchid_org);
+	double bonus = 0.0; 
 	std::string temp;
 	std::string file_name;
 	std::ostringstream strstrm;
 
-	double bonus = 0.0;
-
-	temp = organism->GetUMLModel()->GetXMI();
+	temp = orchid_org->GetUMLModel()->GetXMI();
 	
 	// call hydra when a // all scenario hits its max?
 	// all are non-zero?
-//	if (organism->GetUMLModel()->readyForHydra()) {
-		// print the file to output...
-//		file_name =  "file1" + m_world->GetStats().GetUpdate();
-//		file_name += "." + organism->GetID();
-// Commented out to remove overhead...	
-		strstrm.clear();
-		strstrm << "working."  << m_world->GetStats().GetUpdate() << "." << ctx.GetOrganism()->GetID();
-		strstrm << ".xml";	
-//	if(system(strstrm.str().c_str())!=0) return 0.0;
-		organism->GetUMLModel()->PrintUMLModelToFile(strstrm.str());
-		bonus = 1.0;
-//	} 
+  //	if (orchid_org->GetUMLModel()->readyForHydra()) {
+  // print the file to output...
+  //		file_name =  "file1" + m_world->GetStats().GetUpdate();
+  //		file_name += "." + orchid_org->GetID();
+  // Commented out to remove overhead...	
+  strstrm.clear();
+  strstrm << "working."  << m_world->GetStats().GetUpdate() << "." << ctx.GetOrganism()->GetID();
+  strstrm << ".xml";	
+  //	if(system(strstrm.str().c_str())!=0) return 0.0;
+  orchid_org->GetUMLModel()->PrintUMLModelToFile(strstrm.str());
+  bonus = 1.0;
+  //	} 
 	
 	return bonus;
 }

Modified: branches/uml-merge/source/main/cTaskLib.h
===================================================================
--- branches/uml-merge/source/main/cTaskLib.h	2008-06-24 18:01:14 UTC (rev 2684)
+++ branches/uml-merge/source/main/cTaskLib.h	2008-06-25 14:04:41 UTC (rev 2685)
@@ -300,7 +300,7 @@
   double Task_MoveToEvent(cTaskContext& ctx) const;
   double Task_EventKilled(cTaskContext& ctx) const;
   
-//-------- Orchid tasks --------
+  // -------- Orchid tasks --------
   double Task_Scenarios(cTaskContext& ctx) const;
   double Task_Hydra(cTaskContext& ctx) const;
   double SpinCoprocess(cTaskContext& ctx, const std::string& neverclaimFile) const;
@@ -313,6 +313,7 @@
   double Task_Nondeterminism(cTaskContext& ctx) const;
   double Task_ExportXMI(cTaskContext& ctx) const;
   double Task_Properties(cTaskContext& ctx) const;
+  // -------- End of Orchid tasks. --------
 
 };
 

Added: branches/uml-merge/source/orchid/cOrchidFactory.cc
===================================================================
--- branches/uml-merge/source/orchid/cOrchidFactory.cc	                        (rev 0)
+++ branches/uml-merge/source/orchid/cOrchidFactory.cc	2008-06-25 14:04:41 UTC (rev 2685)
@@ -0,0 +1,21 @@
+#include "cOrchidFactory.h"
+#include "cOrchidOrganism.h"
+#include "cOrchidPopulation.h"
+#include "cPopulation.h"
+#include "cWorld.h"
+
+cOrchidOrganism* cOrchidFactory::BuildOrchidOrganism(cOrchidOrganism* parent) 
+{
+  // For orchid -- provides the offspring with information about its parent's model.
+//  child_array[0]->SetParentXMI(parent.GetUMLModel()->GetXMI());
+//  child_array[0]->SetParentBonus(parent.GetParentBonus());  
+//  child_array[0]->SetParentScenarioCompletion(parent.GetUMLModel()->GetScenarioCompletion());
+  
+  return 0;
+}
+
+
+cOrchidPopulation* cOrchidFactory::BuildOrchidPopulation(const cWorld* world) 
+{
+  return 0;
+}

Added: branches/uml-merge/source/orchid/cOrchidFactory.h
===================================================================
--- branches/uml-merge/source/orchid/cOrchidFactory.h	                        (rev 0)
+++ branches/uml-merge/source/orchid/cOrchidFactory.h	2008-06-25 14:04:41 UTC (rev 2685)
@@ -0,0 +1,17 @@
+#ifndef _C_ORCHID_FACTORY_H_
+#define _C_ORCHID_FACTORY_H_
+
+
+class cOrchidOrganism;
+class cOrchidPopulation;
+class cPopulation;
+class cWorld;
+
+class cOrchidFactory
+{
+public:
+  static cOrchidOrganism* BuildOrchidOrganism(cOrchidOrganism* parent);
+  static cOrchidPopulation* BuildOrchidPopulation(const cWorld* world);
+};
+
+#endif

Added: branches/uml-merge/source/orchid/cOrchidOrganism.cc
===================================================================
--- branches/uml-merge/source/orchid/cOrchidOrganism.cc	                        (rev 0)
+++ branches/uml-merge/source/orchid/cOrchidOrganism.cc	2008-06-25 14:04:41 UTC (rev 2685)
@@ -0,0 +1,111 @@
+#include "cOrchidOrganism.h"
+#include "cWorld.h"
+
+/*! Default constructor for Orchid support.  Initialize all Orchid-related variables
+ that are specific to this organism.
+ */
+cOrchidOrganism::cOrchidOrganism(cWorld* world)
+: m_state_diag(0)
+, m_orig_state_index(0)
+, m_dest_state_index(0)
+, m_model((const char*)world->GetConfig().ORCHID_SEED_MODEL.Get())
+{
+}
+
+
+/*! Model check this organism... (more)
+ */
+void cOrchidOrganism::ModelCheck(cAvidaContext& ctx)
+{
+	if(m_model.GetGenMode() == 0) {
+		m_model.PrintXMI();	
+		// Update the value of max trans
+		if(m_model.NumTrans() > m_model.GetMaxTrans()) { 
+      m_model.SetMaxTrans(m_model.NumTrans());
+		} 
+	}
+	
+//  DoOutput(ctx, true);
+  
+	cUMLModel* org_model = GetUMLModel();
+  //	cUMLModel* pop_model = m_world->GetPopulation().GetUMLModel();
+  //	m_world->GetStats().OrchidStatsPostTaskCheck(org_model, pop_model);
+	m_model.GetPropertyGenerator()->ResetPropertyReward();
+}
+
+
+cUMLModel* cOrchidOrganism::GetUMLModel()
+{
+  return &m_model;
+}
+
+
+bool cOrchidOrganism::AbsoluteJumpStateDiagram(int amount)
+{
+	m_state_diag = 0;
+	return RelativeJumpStateDiagram(amount);
+}
+
+
+bool cOrchidOrganism::RelativeJumpStateDiagram(int amount)
+{
+	int size = GetUMLModel()->GetStateDiagramSize();
+	
+	if(size == 0) {
+		return false;
+	}
+	
+	if(size > 0) { 
+		m_state_diag += (amount % size);
+    
+		// index is greater than vector
+		if(m_state_diag >= size) { 
+			m_state_diag -= size;
+		} else if(m_state_diag < 0) { 
+			m_state_diag += size;
+		}
+	}	
+  
+	return true;
+}
+
+
+cUMLStateDiagram* cOrchidOrganism::GetStateDiagram() 
+{ 
+  return m_model.GetStateDiagram(m_state_diag);
+}
+
+
+bool cOrchidOrganism::AbsoluteJumpOriginState(int amount)
+{
+	m_orig_state_index = 0;
+	return (RelativeJumpOriginState(amount));
+}
+
+
+bool cOrchidOrganism::AbsoluteJumpDestinationState(int amount)
+{
+	m_dest_state_index = 0;
+	return (RelativeJumpDestinationState(amount));
+}
+
+
+bool cOrchidOrganism::AddTransitionTotal() 
+{
+	bool val;
+	val = GetStateDiagram()->AddTransitionTotal();	
+	return val;
+}
+
+bool cOrchidOrganism::RelativeJumpOriginState(int amount) 
+{ 
+	m_orig_state_index += amount; 
+	return true;
+}
+
+bool cOrchidOrganism::RelativeJumpDestinationState(int amount) 
+{ 
+	m_dest_state_index += amount; 
+	return true;
+}
+

Added: branches/uml-merge/source/orchid/cOrchidOrganism.h
===================================================================
--- branches/uml-merge/source/orchid/cOrchidOrganism.h	                        (rev 0)
+++ branches/uml-merge/source/orchid/cOrchidOrganism.h	2008-06-25 14:04:41 UTC (rev 2685)
@@ -0,0 +1,67 @@
+#ifndef _C_ORCHIDORGANISM_H_
+#define _C_ORCHIDORGANISM_H_
+
+#include "cAvidaContext.h"
+#include "cUMLModel.h"
+
+#include <map>
+#include <string>
+#include <vector>
+
+class cWorld;
+
+/*! The cOrchidOrganism class is the entry-point for all Orchid-related functionality that is
+ specific to an individual organism.
+ 
+ \see cOrchidPopulation for functionality that is to be shared among individuals.
+ */
+class cOrchidOrganism
+{
+public:
+  //! Default constructor.
+  cOrchidOrganism(cWorld* world);
+  //!
+  void ModelCheck(cAvidaContext& ctx);
+  //!
+  cUMLModel* GetUMLModel();
+  //! Return the XMI string for the model generated by this organism's parent.
+  const std::string& GetParentXMI() { return m_parent_xmi; }
+  //!
+  int GetStateDiagramIndex() { return m_state_diag; } 
+  //! (use meaningful names for parameters)
+  bool CurrTrans (int, int, int, int, int, int); 
+  //! 
+  cUMLStateDiagram* GetStateDiagram();
+  //! consider const std::string& (parameter name)
+  void SetParentXMI(const std::string& xmi) { m_parent_xmi = xmi; } 
+  //!
+  void SetParentBonus(const std::map<std::string,float>& parent_bonus) { m_parent_bonus = parent_bonus; }
+  //! (names) 
+  float GetParentBonus(const std::string& s) { return m_parent_bonus[s]; }
+  //! Returns the bonus map for this organism's parent.
+  const std::map<std::string, float>& GetParentBonus() { return m_parent_bonus; }
+  //! Returns a vector for scenario completion of this organism's parent.
+  const std::vector<double>& GetParentScenarioCompletion() { return m_parent_scenario_completion; } 
+  //! (names)
+  void SetParentScenarioCompletion (const std::vector<double>& s) { m_parent_scenario_completion = s; }
+  
+  // The jump functions jump the index of the various vectors either forward (+ int) or backwards (- int)
+  bool AbsoluteJumpOriginState(int);
+  bool AbsoluteJumpDestinationState(int);
+  bool AbsoluteJumpStateDiagram (int);
+  bool RelativeJumpOriginState(int amount);
+  bool RelativeJumpDestinationState(int amount);
+  bool RelativeJumpStateDiagram (int); 
+  bool AddTransitionTotal();
+  
+protected:
+  int m_state_diag; //!< Index of the state diagram currently being manipulated.
+  int m_orig_state_index; //!<
+  int m_dest_state_index; //!<
+  cUMLModel m_model; //!<
+  std::string m_parent_xmi; //!<
+  std::map<std::string, float> m_parent_bonus; //!<
+  std::vector<double> m_parent_scenario_completion; //!<
+};
+
+#endif

Added: branches/uml-merge/source/orchid/cOrchidPopulation.h
===================================================================
--- branches/uml-merge/source/orchid/cOrchidPopulation.h	                        (rev 0)
+++ branches/uml-merge/source/orchid/cOrchidPopulation.h	2008-06-25 14:04:41 UTC (rev 2685)
@@ -0,0 +1,15 @@
+#ifndef _C_ORCHIDPOPULATIONINTERFACE_H_
+#define _C_ORCHIDPOPULATIONINTERFACE_H_
+
+class cOrchidPopulation
+{
+public:
+  cOrchidPopulation();
+  
+  cUMLModel* GetUMLModel() { return m_model; }
+
+protected:
+  cUMLModel* m_model;
+};
+
+#endif




More information about the Avida-cvs mailing list