[Avida-SVN] r2973 - in development: Avida.xcodeproj source/actions source/cpu source/main tests/hoarding_instn_analyze

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Tue Nov 25 22:45:10 PST 2008


Author: brysonda
Date: 2008-11-26 01:45:10 -0500 (Wed, 26 Nov 2008)
New Revision: 2973

Added:
   development/source/main/cStateGrid.h
Modified:
   development/Avida.xcodeproj/project.pbxproj
   development/source/actions/EnvironmentActions.cc
   development/source/cpu/cHardwareBase.cc
   development/source/cpu/cHardwareBase.h
   development/source/cpu/cHardwareCPU.cc
   development/source/cpu/cHardwareCPU.h
   development/source/cpu/cHardwareExperimental.cc
   development/source/cpu/cHardwareExperimental.h
   development/source/cpu/cHardwareGX.cc
   development/source/cpu/cHardwareGX.h
   development/source/cpu/cHardwareManager.h
   development/source/cpu/cHardwareSMT.cc
   development/source/cpu/cHardwareSMT.h
   development/source/cpu/cHardwareTransSMT.cc
   development/source/cpu/cHardwareTransSMT.h
   development/source/main/cEnvironment.cc
   development/source/main/cEnvironment.h
   development/source/main/cOrganism.cc
   development/source/main/cOrganism.h
   development/source/main/cPhenotype.cc
   development/source/main/cTaskContext.h
   development/tests/hoarding_instn_analyze/test_list
Log:
First steps towards state grid based movement.

Added general purpose (though non-concurrent use) extended memory array to cHardwareBase.  This memory block is available via the task context for task evaluation.

Re-organized hardware reset methods. cHardwareBase now handles basic resetting itself, including notifying the cOrganism object of the hardware reset.  After these steps have finished it calls the internalReset virtual method to allow the concrete hardware classes to perform hardware specific reset operations.

Added cStateGrid class. This class holds basic state grid (a.k.a. the dream-a-grid) information.  cEnvironment will load this information from the environment file, though it does not currently do so.   When one (or more) of these state grids exist, cOrganism activates a block of its hardware object's extended memory as a location and observed state count facility.  Currently this behavior is limited to a hard-coded link to the first state grid loaded.

Added several new sg- instructions in cHardwareCPU for manipulating the organism's location on its state grid.  Movement and rotate have been implemented, but the sense instruction is currently incomplete.

Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/Avida.xcodeproj/project.pbxproj	2008-11-26 06:45:10 UTC (rev 2973)
@@ -170,6 +170,7 @@
 		7023ECDE0C0A44D800362B9C /* libavida-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7023EC330C0A426900362B9C /* libavida-core.a */; };
 		7023ECDF0C0A44D900362B9C /* libtcmalloc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 70AA941909D486AE006A24C8 /* libtcmalloc.a */; };
 		702F532F0993060A00B2B507 /* avida-s in CopyFiles */ = {isa = PBXBuildFile; fileRef = 70DCAD1C097AF7CC002F8733 /* avida-s */; };
+		70310E6B0EDD09260044971B /* cStateGrid.h in Headers */ = {isa = PBXBuildFile; fileRef = 70310E690EDD09260044971B /* cStateGrid.h */; };
 		70381F810EAD0BD000A97DFD /* ASAnalyzeLib.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70381F800EAD0BD000A97DFD /* ASAnalyzeLib.cc */; };
 		7039884D09F00D020052ACE7 /* analyze.cfg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 707AF2D309EE8501001AEA89 /* analyze.cfg */; };
 		7039884E09F00D030052ACE7 /* avida.cfg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 707AF2D509EE8501001AEA89 /* avida.cfg */; };
@@ -426,6 +427,7 @@
 		702F52A80992F8F600B2B507 /* cSymbolTable.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cSymbolTable.cc; sourceTree = "<group>"; };
 		702F52DE0992FD8000B2B507 /* cScriptObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cScriptObject.h; sourceTree = "<group>"; };
 		702F52DF0992FD8000B2B507 /* cScriptObject.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cScriptObject.cc; sourceTree = "<group>"; };
+		70310E690EDD09260044971B /* cStateGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cStateGrid.h; sourceTree = "<group>"; };
 		70381F7F0EAD0BD000A97DFD /* ASAnalyzeLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASAnalyzeLib.h; sourceTree = "<group>"; };
 		70381F800EAD0BD000A97DFD /* ASAnalyzeLib.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ASAnalyzeLib.cc; sourceTree = "<group>"; };
 		70381FDB0EAE2A2A00A97DFD /* ASAvidaNativeObjects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASAvidaNativeObjects.h; sourceTree = "<group>"; };
@@ -1533,6 +1535,7 @@
 				7099EEBF0B2F9D2A001269F6 /* cEnvReqs.h */,
 				70166B8D0B519CFE009533A5 /* cTaskState.h */,
 				709A1E540EB69DA6006090AF /* cResourceHistory.h */,
+				70310E690EDD09260044971B /* cStateGrid.h */,
 			);
 			path = main;
 			sourceTree = "<group>";
@@ -1718,6 +1721,7 @@
 				2A57A4000D6B954D00FC54C7 /* cProbDemeProbSchedule.h in Headers */,
 				709A1EEB0EB6C42D006090AF /* cOrgMovementPredicate.h in Headers */,
 				70211A5D0ECBD531004A293A /* cRCObject.h in Headers */,
+				70310E6B0EDD09260044971B /* cStateGrid.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: development/source/actions/EnvironmentActions.cc
===================================================================
--- development/source/actions/EnvironmentActions.cc	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/actions/EnvironmentActions.cc	2008-11-26 06:45:10 UTC (rev 2973)
@@ -28,12 +28,13 @@
 #include "cAction.h"
 #include "cActionLibrary.h"
 #include "cEnvironment.h"
+#include "cOrganism.h"
+#include "cPhenotype.h"
 #include "cPopulation.h"
+#include "cPopulationCell.h"
 #include "cResource.h"
 #include "cStats.h"
 #include "cWorld.h"
-#include "cPhenotype.h"
-#include "cPopulationCell.h"
 
 class cActionInjectResource : public cAction
 {

Modified: development/source/cpu/cHardwareBase.cc
===================================================================
--- development/source/cpu/cHardwareBase.cc	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/cpu/cHardwareBase.cc	2008-11-26 06:45:10 UTC (rev 2973)
@@ -48,6 +48,27 @@
 #include "functions.h"
 
 
+void cHardwareBase::Reset()
+{
+  m_organism->HardwareReset();
+
+  m_inst_cost = 0;
+  
+  const int num_inst_cost = m_inst_set->GetSize();
+  
+  if (m_has_ft_costs) {
+    m_inst_ft_cost.Resize(num_inst_cost);
+    for (int i = 0; i < num_inst_cost; i++) m_inst_ft_cost[i] = m_inst_set->GetFTCost(cInstruction(i));
+  }
+  
+  if (m_has_energy_costs) {
+    m_inst_energy_cost.Resize(num_inst_cost);
+    for (int i = 0; i < num_inst_cost; i++) m_inst_energy_cost[i] = m_inst_set->GetEnergyCost(cInstruction(i));
+  }
+
+  internalReset();
+}
+
 int cHardwareBase::GetExecutedSize(const int parent_size)
 {
   int executed_size = 0;
@@ -883,23 +904,7 @@
   return true;
 }
 
-void cHardwareBase::ResetInstructionCosts()
-{
-  m_inst_cost = 0;
 
-  const int num_inst_cost = m_inst_set->GetSize();
-
-  if (m_has_ft_costs) {
-    m_inst_ft_cost.Resize(num_inst_cost);
-    for (int i = 0; i < num_inst_cost; i++) m_inst_ft_cost[i] = m_inst_set->GetFTCost(cInstruction(i));
-  }
-  
-  if (m_has_energy_costs) {
-    m_inst_energy_cost.Resize(num_inst_cost);
-    for (int i = 0; i < num_inst_cost; i++) m_inst_energy_cost[i] = m_inst_set->GetEnergyCost(cInstruction(i));
-  }
-}
-
 //! Called when the organism that owns this CPU has received a flash from a neighbor.
 void cHardwareBase::ReceiveFlash() {
   m_world->GetDriver().RaiseFatalException(1, "Method cHardwareBase::ReceiveFlash must be overriden.");

Modified: development/source/cpu/cHardwareBase.h
===================================================================
--- development/source/cpu/cHardwareBase.h	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/cpu/cHardwareBase.h	2008-11-26 06:45:10 UTC (rev 2973)
@@ -59,7 +59,7 @@
   cInstSet* m_inst_set;      // Instruction set being used.
   cHardwareTracer* m_tracer; // Set this if you want execution traced.
 
-  // --------  Instruction Costs ---------
+  // --------  Instruction Costs  ---------
   int m_inst_cost;
   tArray<int> m_inst_ft_cost;
   tArray<int> m_inst_energy_cost;
@@ -68,8 +68,9 @@
   bool m_has_ft_costs;
   bool m_has_energy_costs;
   
+  // --------  Base Hardware Feature Support  ---------
+  tArray<int> m_ext_mem;
   
-  
 
   cHardwareBase(); // @not_implemented
   cHardwareBase(const cHardwareBase&); // @not_implemented
@@ -86,13 +87,13 @@
   }
   virtual ~cHardwareBase() { ; }
 
-  // --------  Organism ---------
+  // --------  Organism  ---------
   cOrganism* GetOrganism() { return m_organism; }
   const cInstSet& GetInstSet() { return *m_inst_set; }
 
   
   // --------  Core Functionality  --------
-  virtual void Reset() = 0;
+  void Reset();
   virtual bool SingleProcess(cAvidaContext& ctx, bool speculative = false) = 0;
   virtual void ProcessBonusInst(cAvidaContext& ctx, const cInstruction& inst) = 0;
 
@@ -104,6 +105,7 @@
   virtual bool OK() = 0;
   virtual void PrintStatus(std::ostream& fp) = 0;
   void SetTrace(cHardwareTracer* tracer) { m_tracer = tracer; }
+  void SetupExtendedMemory(const tArray<int>& ext_mem) { m_ext_mem = ext_mem; }
   
   
   // --------  Stack Manipulation...  --------
@@ -135,7 +137,9 @@
   virtual int GetMemSize(int value) const = 0;
   virtual int GetNumMemSpaces() const = 0;
   
+  const tArray<int>& GetExtendedMemory() const { return m_ext_mem; }
   
+  
   // --------  Register Manipulation  --------
   virtual int GetRegister(int reg_id) const = 0;
   virtual int GetNumRegisters() const = 0;
@@ -180,6 +184,8 @@
 
   
 protected:
+  virtual void internalReset() = 0;
+  
   // --------  No-Operation Instruction --------
   bool Inst_Nop(cAvidaContext& ctx);  // A no-operation instruction that does nothing! 
   
@@ -210,9 +216,6 @@
 																	 cCPUMemory& target_memory, cHeadCPU& cur_head, const double rate);
   
   virtual bool SingleProcess_PayCosts(cAvidaContext& ctx, const cInstruction& cur_inst);
-  void ResetInstructionCosts();
-  
-  
 };
 
 

Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/cpu/cHardwareCPU.cc	2008-11-26 06:45:10 UTC (rev 2973)
@@ -47,6 +47,7 @@
 #include "cReactionLib.h"
 #include "cReactionProcess.h"
 #include "cResource.h"
+#include "cStateGrid.h"
 #include "cStringUtil.h"
 #include "cTestCPU.h"
 #include "cWorldDriver.h"
@@ -249,7 +250,15 @@
     tInstLibEntry<tMethod>("get-cell-y", &cHardwareCPU::Inst_GetCellPositionY),
     tInstLibEntry<tMethod>("dist-from-diag", &cHardwareCPU::Inst_GetDistanceFromDiagonal),
 
-    // @WRE additions for movement
+    // State Grid instructions
+    tInstLibEntry<tMethod>("sg-move", &cHardwareCPU::Inst_SGMove),
+    tInstLibEntry<tMethod>("sg-rotate-l", &cHardwareCPU::Inst_SGRotateL),
+    tInstLibEntry<tMethod>("sg-rotate-r", &cHardwareCPU::Inst_SGRotateR),
+    tInstLibEntry<tMethod>("sg-sense", &cHardwareCPU::Inst_SGSense),
+    
+
+    
+    // Movement instructions
     tInstLibEntry<tMethod>("tumble", &cHardwareCPU::Inst_Tumble, nInstFlag::STALL),
     tInstLibEntry<tMethod>("move", &cHardwareCPU::Inst_Move, nInstFlag::STALL),
     tInstLibEntry<tMethod>("move-to-event", &cHardwareCPU::Inst_MoveToEvent, nInstFlag::STALL),
@@ -529,7 +538,7 @@
 }
 
 
-void cHardwareCPU::Reset()
+void cHardwareCPU::internalReset()
 {
   m_global_stack.Clear();
   
@@ -553,8 +562,6 @@
   m_executedmatchstrings = false;
   
 
-  ResetInstructionCosts();
-
   // Promoter model
   if (m_world->GetConfig().PROMOTERS_ENABLED.Get())
   {
@@ -4460,6 +4467,85 @@
   return true;
 }
 
+
+
+bool cHardwareCPU::Inst_SGMove(cAvidaContext& ctx)
+{
+  assert(m_ext_mem.GetSize() > 3);
+  
+  const cStateGrid& sg = m_organism->GetStateGrid();
+  
+  int& x = m_ext_mem[0];
+  int& y = m_ext_mem[1];
+  
+  const int facing = m_ext_mem[2];
+  
+  // State grid is treated as a 2-dimensional toroidal grid with size [0, width) and [0, height)
+  switch (facing) {
+    case 0: // N
+      if (++y == sg.GetHeight()) y = 0;
+      break;
+      
+    case 1: // NE
+      if (++x == sg.GetWidth()) x = 0;
+      if (++y == sg.GetHeight()) y = 0;
+      break;
+      
+    case 2: // E
+      if (++x == sg.GetWidth()) x = 0;
+      break;
+
+    case 3: // SE
+      if (++x == sg.GetWidth()) x = 0;
+      if (--y == -1) y = sg.GetHeight() - 1;
+      break;
+      
+    case 4: // S
+      if (--y == -1) y = sg.GetHeight() - 1;
+      break;
+
+    case 5: // SW
+      if (--x == -1) x = sg.GetWidth() - 1;
+      if (--y == -1) y = sg.GetHeight() - 1;
+      break;
+      
+    case 6: // W
+      if (--x == -1) x = sg.GetWidth() - 1;
+      break;
+
+    case 7: // NW
+      if (--x == -1) x = sg.GetWidth() - 1;
+      if (++y == sg.GetHeight()) y = 0;
+      break;
+            
+    default:
+      assert(facing >= 0 && facing <= 7);
+  }
+  
+  m_ext_mem[3 + sg.GetStateAt(x, y)]++;
+  return true;
+}
+
+bool cHardwareCPU::Inst_SGRotateL(cAvidaContext& ctx)
+{
+  assert(m_ext_mem.GetSize() > 3);
+  if (--m_ext_mem[2] < 0) m_ext_mem[2] = 7;
+  return true;
+}
+
+bool cHardwareCPU::Inst_SGRotateR(cAvidaContext& ctx)
+{
+  assert(m_ext_mem.GetSize() > 3);
+  if (++m_ext_mem[2] > 7) m_ext_mem[2] = 0;
+  return true;
+}
+
+bool cHardwareCPU::Inst_SGSense(cAvidaContext& ctx)
+{
+  // @TODO - state grid sense instruction
+  return true;
+}
+
 // @WRE addition for movement
 // Move uses the cPopulation::SwapCells method to move an m_organism to a different cell
 // and the cPopulation::MoveOrganisms helper function to clean up after a move

Modified: development/source/cpu/cHardwareCPU.h
===================================================================
--- development/source/cpu/cHardwareCPU.h	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/cpu/cHardwareCPU.h	2008-11-26 06:45:10 UTC (rev 2973)
@@ -218,6 +218,10 @@
   bool Allocate_Default(const int new_size);
   bool Allocate_Main(cAvidaContext& ctx, const int allocated_size);
   
+
+  void internalReset();
+  
+  
   int GetCopiedSize(const int parent_size, const int child_size);
   
   bool Divide_Main(cAvidaContext& ctx, const int divide_point, const int extra_lines=0, double mut_multiplier=1);
@@ -244,7 +248,6 @@
   static tInstLib<tMethod>* GetInstLib() { return s_inst_slib; }
   static cString GetDefaultInstFilename() { return "instset-classic.cfg"; }
 
-  void Reset();
   bool SingleProcess(cAvidaContext& ctx, bool speculative = false);
   void ProcessBonusInst(cAvidaContext& ctx, const cInstruction& inst);
 
@@ -513,9 +516,13 @@
   bool Inst_GetCellPosition(cAvidaContext& ctx);
   bool Inst_GetCellPositionX(cAvidaContext& ctx);
   bool Inst_GetCellPositionY(cAvidaContext& ctx);
+  
+  bool Inst_SGMove(cAvidaContext& ctx);
+  bool Inst_SGRotateL(cAvidaContext& ctx);
+  bool Inst_SGRotateR(cAvidaContext& ctx);
+  bool Inst_SGSense(cAvidaContext& ctx);
 
   bool Inst_GetDistanceFromDiagonal(cAvidaContext& ctx);
-  // @WRE additions for movement
   bool Inst_Tumble(cAvidaContext& ctx);
   bool Inst_Move(cAvidaContext& ctx);
   bool Inst_MoveToEvent(cAvidaContext& ctx);

Modified: development/source/cpu/cHardwareExperimental.cc
===================================================================
--- development/source/cpu/cHardwareExperimental.cc	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/cpu/cHardwareExperimental.cc	2008-11-26 06:45:10 UTC (rev 2973)
@@ -223,7 +223,7 @@
 }
 
 
-void cHardwareExperimental::Reset()
+void cHardwareExperimental::internalReset()
 {
   m_cycle_count = 0;
   m_last_output = 0;
@@ -240,8 +240,6 @@
   m_mal_active = false;
   m_executedmatchstrings = false;
   
-  ResetInstructionCosts();
-
   // Promoter model
   if (m_world->GetConfig().PROMOTERS_ENABLED.Get()) {
     m_promoter_index = -1; // Meaning the last promoter was nothing

Modified: development/source/cpu/cHardwareExperimental.h
===================================================================
--- development/source/cpu/cHardwareExperimental.h	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/cpu/cHardwareExperimental.h	2008-11-26 06:45:10 UTC (rev 2973)
@@ -260,6 +260,10 @@
   bool Allocate_Default(const int new_size);
   bool Allocate_Main(cAvidaContext& ctx, const int allocated_size);
   
+
+  void internalReset();
+  
+  
   int GetCopiedSize(const int parent_size, const int child_size);
   
   bool Divide_Main(cAvidaContext& ctx, const int divide_point, const int extra_lines=0, double mut_multiplier=1);
@@ -281,7 +285,6 @@
   static tInstLib<cHardwareExperimental::tMethod>* GetInstLib() { return s_inst_slib; }
   static cString GetDefaultInstFilename() { return "instset-experimental.cfg"; }
 
-  void Reset();
   bool SingleProcess(cAvidaContext& ctx, bool speculative = false);
   void ProcessBonusInst(cAvidaContext& ctx, const cInstruction& inst);
 

Modified: development/source/cpu/cHardwareGX.cc
===================================================================
--- development/source/cpu/cHardwareGX.cc	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/cpu/cHardwareGX.cc	2008-11-26 06:45:10 UTC (rev 2973)
@@ -330,7 +330,7 @@
 /*! Reset this cHardwareGX to a known state.  
 Removes all the current cProgramids, and creates new cProgramids from the germ.
 */
-void cHardwareGX::Reset()
+void cHardwareGX::internalReset()
 {
   // Clear the current list of programids.
   std::for_each(m_programids.begin(), m_programids.end(), delete_functor());
@@ -406,7 +406,6 @@
   m_mal_active = false;
   m_executedmatchstrings = false;
   
-  ResetInstructionCosts();
 }
 
 /*! In cHardwareGX, SingleProcess is something of a misnomer.  Each time this method

Modified: development/source/cpu/cHardwareGX.h
===================================================================
--- development/source/cpu/cHardwareGX.h	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/cpu/cHardwareGX.h	2008-11-26 06:45:10 UTC (rev 2973)
@@ -294,6 +294,10 @@
   bool Allocate_Default(const int new_size);
   bool Allocate_Main(cAvidaContext& ctx, const int allocated_size);
   
+
+  void internalReset();
+  
+    
   int GetExecutedSize(const int parent_size);
   int GetCopiedSize(const int parent_size, const int child_size);
   bool Divide_Main(cAvidaContext& ctx);
@@ -309,7 +313,6 @@
   static tInstLib<tMethod>* GetInstLib() { return s_inst_slib; }
   static cString GetDefaultInstFilename() { return "instset-gx.cfg"; }
 
-  void Reset();
   bool SingleProcess(cAvidaContext& ctx, bool speculative = false);
   void ProcessBonusInst(cAvidaContext& ctx, const cInstruction& inst);
 

Modified: development/source/cpu/cHardwareManager.h
===================================================================
--- development/source/cpu/cHardwareManager.h	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/cpu/cHardwareManager.h	2008-11-26 06:45:10 UTC (rev 2973)
@@ -52,6 +52,7 @@
   int m_type;
   int m_cpu_count;
   
+  
   cHardwareManager(); // @not_implemented
   cHardwareManager(const cHardwareManager&); // @not_implemented
   cHardwareManager& operator=(const cHardwareManager&); // @not_implemented

Modified: development/source/cpu/cHardwareSMT.cc
===================================================================
--- development/source/cpu/cHardwareSMT.cc	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/cpu/cHardwareSMT.cc	2008-11-26 06:45:10 UTC (rev 2973)
@@ -146,7 +146,7 @@
   Reset();                            // Setup the rest of the hardware...
 }
 
-void cHardwareSMT::Reset()
+void cHardwareSMT::internalReset()
 {
   // Setup the memory...
   m_mem_array.Resize(1);
@@ -166,10 +166,6 @@
   for(int i = 0; i < NUM_STACKS; i++) {
 		Stack(i).Clear();
 	}
-	
-  ResetInstructionCosts();
-  
-  m_organism->NetReset();
 }
 
 void cHardwareSMT::cLocalThread::Reset(cHardwareBase* in_hardware, int mem_space)

Modified: development/source/cpu/cHardwareSMT.h
===================================================================
--- development/source/cpu/cHardwareSMT.h	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/cpu/cHardwareSMT.h	2008-11-26 06:45:10 UTC (rev 2973)
@@ -179,6 +179,10 @@
   bool Allocate_Default(const int new_size);
   bool Allocate_Main(const int allocated_size);
 
+
+  void internalReset();
+  
+  
 	int GetCopiedSize(const int parent_size, const int child_size);
   
   bool Divide_Main(cAvidaContext& ctx, double mut_multiplier = 1.0);
@@ -201,7 +205,6 @@
   static cInstLib* GetInstLib() { return s_inst_slib; }
   static cString GetDefaultInstFilename() { return "instset-smt.cfg"; }
 	
-  void Reset();
   bool SingleProcess(cAvidaContext& ctx, bool speculative = false);
   void ProcessBonusInst(cAvidaContext& ctx, const cInstruction& inst);
 	

Modified: development/source/cpu/cHardwareTransSMT.cc
===================================================================
--- development/source/cpu/cHardwareTransSMT.cc	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/cpu/cHardwareTransSMT.cc	2008-11-26 06:45:10 UTC (rev 2973)
@@ -145,7 +145,7 @@
   Reset();                            // Setup the rest of the hardware...
 }
 
-void cHardwareTransSMT::Reset()
+void cHardwareTransSMT::internalReset()
 {
   // Setup the memory...
   m_mem_array.Resize(1);
@@ -164,10 +164,7 @@
 		Stack(i).Clear();
 	}
 	
-  ResetInstructionCosts();
-  
   m_organism->ClearParasites();
-  m_organism->NetReset();
 }
 
 void cHardwareTransSMT::cLocalThread::Reset(cHardwareBase* in_hardware, int mem_space)

Modified: development/source/cpu/cHardwareTransSMT.h
===================================================================
--- development/source/cpu/cHardwareTransSMT.h	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/cpu/cHardwareTransSMT.h	2008-11-26 06:45:10 UTC (rev 2973)
@@ -178,8 +178,12 @@
   bool Allocate_Default(const int new_size);
   bool Allocate_Main(const int allocated_size);
 
-	int GetCopiedSize(const int parent_size, const int child_size);
+
+  void internalReset();
   
+  
+  int GetCopiedSize(const int parent_size, const int child_size);
+  
   bool Divide_Main(cAvidaContext& ctx, double mut_multiplier = 1.0);
   void Inject_DoMutations(cAvidaContext& ctx, double mut_multiplier, cCPUMemory& injected_code);
 
@@ -200,7 +204,6 @@
   static cInstLib* GetInstLib() { return s_inst_slib; }
   static cString GetDefaultInstFilename() { return "instset-transsmt.cfg"; }
 	
-  void Reset();
   bool SingleProcess(cAvidaContext& ctx, bool speculative = false);
   void ProcessBonusInst(cAvidaContext& ctx, const cInstruction& inst);
 	

Modified: development/source/main/cEnvironment.cc
===================================================================
--- development/source/main/cEnvironment.cc	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/main/cEnvironment.cc	2008-11-26 06:45:10 UTC (rev 2973)
@@ -42,6 +42,7 @@
 #include "cReactionRequisite.h"
 #include "cReactionResult.h"
 #include "cResource.h"
+#include "cStateGrid.h"
 #include "cStringUtil.h"
 #include "cTaskEntry.h"
 #include "cTools.h"
@@ -56,6 +57,12 @@
 using namespace std;
 
 
+cEnvironment::~cEnvironment()
+{
+  for (int i = 0; i < m_state_grids.GetSize(); i++) delete m_state_grids[i];
+}
+
+
 bool cEnvironment::ParseSetting(cString entry, cString& var_name, cString& var_value, const cString& var_type)
 {
   // Make sure we have an actual entry to parse.
@@ -721,6 +728,14 @@
   return true;
 }
 
+
+bool cEnvironment::LoadStateGrid(cString desc)
+{
+  // @TODO - state grid load line
+  return true;
+}
+
+
 bool cEnvironment::LoadSetActive(cString desc)
 {
   cString item_type = desc.PopWord(); 
@@ -765,6 +780,7 @@
   else if (type == "MUTATION") load_ok = LoadMutation(line);
   else if (type == "SET_ACTIVE") load_ok = LoadSetActive(line);
   else if (type == "CELL") load_ok = LoadCell(line);
+  else if (type == "GRID") load_ok = LoadStateGrid(line);
   else {
     cerr << "Error: Unknown environment keyword '" << type << "." << endl;
     return false;

Modified: development/source/main/cEnvironment.h
===================================================================
--- development/source/main/cEnvironment.h	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/main/cEnvironment.h	2008-11-26 06:45:10 UTC (rev 2973)
@@ -68,6 +68,7 @@
 template <class T> class tArray;
 class cReactionProcess;
 class cReactionResult;
+class cStateGrid;
 template <class T> class tBuffer;
 class cTaskContext;
 class cWorld;
@@ -95,6 +96,9 @@
   
   unsigned int m_mask;
   
+  tArray<cStateGrid*> m_state_grids;
+  
+  
   static bool ParseSetting(cString entry, cString& var_name, cString& var_value, const cString& var_type);
   static bool AssertInputInt(const cString& input, const cString& name, const cString& type);
   static bool AssertInputDouble(const cString& input, const cString& name, const cString& type);
@@ -107,6 +111,7 @@
   bool LoadCell(cString desc);
   bool LoadReaction(cString desc);
   bool LoadMutation(cString desc);
+  bool LoadStateGrid(cString desc);
 
   bool LoadSetActive(cString desc);
 
@@ -123,7 +128,7 @@
 
 public:
   inline cEnvironment(cWorld* world);
-  inline ~cEnvironment() { ; }
+  ~cEnvironment();
 
   bool Load(const cString& filename);  // Reads the environment from disk.
   bool LoadLine(cString line);  // Reads in a single environment configuration line
@@ -157,6 +162,9 @@
   cReactionLib& GetReactionLib() { return reaction_lib; }
   cMutationRates& GetMutRates() { return mut_rates; }
   
+  int GetNumStateGrids() const { return m_state_grids.GetSize(); }
+  const cStateGrid& GetStateGrid(int sg) const { return *m_state_grids[sg]; }  
+
   int GetInputSize()  const { return m_input_size; };
   int GetOutputSize() const { return m_output_size; };
 

Modified: development/source/main/cOrganism.cc
===================================================================
--- development/source/main/cOrganism.cc	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/main/cOrganism.cc	2008-11-26 06:45:10 UTC (rev 2973)
@@ -39,6 +39,7 @@
 #include "cOrgSinkMessage.h"
 #include "cPopulationCell.h"
 #include "cPopulation.h"
+#include "cStateGrid.h"
 #include "cStringUtil.h"
 #include "cTaskContext.h"
 #include "cTools.h"
@@ -65,6 +66,7 @@
   , m_input_buf(world->GetEnvironment().GetInputSize())
   , m_output_buf(world->GetEnvironment().GetOutputSize())
   , m_received_messages(RECEIVED_MESSAGES_SIZE)
+  , m_cur_sg(0)
   , m_sent_value(0)
   , m_sent_active(false)
   , m_test_receive_pos(0)
@@ -97,6 +99,7 @@
   , m_input_buf(world->GetEnvironment().GetInputSize())
   , m_output_buf(world->GetEnvironment().GetOutputSize())
   , m_received_messages(RECEIVED_MESSAGES_SIZE)
+  , m_cur_sg(0)
   , m_sent_value(0)
   , m_sent_active(false)
   , m_test_receive_pos(0)
@@ -134,10 +137,11 @@
   }
   
   if (m_world->GetConfig().NET_ENABLED.Get()) m_net = new cNetSupport();
-  m_id = m_world->GetStats().GetTotCreatures();  
+  m_id = m_world->GetStats().GetTotCreatures();
 }
 
 
+
 cOrganism::~cOrganism()
 {
   assert(m_is_running == false);
@@ -164,6 +168,8 @@
   m_rbins.SetAll(0.0);
 }
 
+const cStateGrid& cOrganism::GetStateGrid() const { return m_world->GetEnvironment().GetStateGrid(m_cur_sg); }
+
 double cOrganism::GetRBinsTotal()
 {
 	double total = 0;
@@ -252,25 +258,25 @@
 
 void cOrganism::DoOutput(cAvidaContext& ctx, const bool on_divide)
 {
-  DoOutput(ctx, m_input_buf, m_output_buf, on_divide, false);
+  doOutput(ctx, m_input_buf, m_output_buf, on_divide, false);
 }
 
 
 void cOrganism::DoOutput(cAvidaContext& ctx, const int value)
 {
   m_output_buf.Add(value);
-  DoOutput(ctx, m_input_buf, m_output_buf, false, NetValidate(ctx, value));
+  doOutput(ctx, m_input_buf, m_output_buf, false, NetValidate(ctx, value));
 }
 
 
 void cOrganism::DoOutput(cAvidaContext& ctx, tBuffer<int>& input_buffer, tBuffer<int>& output_buffer, const int value)
 {
   output_buffer.Add(value);
-  DoOutput(ctx, input_buffer, output_buffer, false, NetValidate(ctx, value));
+  doOutput(ctx, input_buffer, output_buffer, false, NetValidate(ctx, value));
 }
 
 
-void cOrganism::DoOutput(cAvidaContext& ctx, 
+void cOrganism::doOutput(cAvidaContext& ctx, 
                          tBuffer<int>& input_buffer, 
                          tBuffer<int>& output_buffer,
                          const bool on_divide,
@@ -318,14 +324,15 @@
   tBuffer<int>* received_messages_point = &m_received_messages;
   if (!m_world->GetConfig().SAVE_RECEIVED.Get()) received_messages_point = NULL;
   
-  cTaskContext taskctx(m_interface, input_buffer, output_buffer, other_input_list, 
-                       other_output_list, net_valid, 0, on_divide, received_messages_point, this);
+  cTaskContext taskctx(m_interface, input_buffer, output_buffer, other_input_list, other_output_list,
+                       m_hardware->GetExtendedMemory(), net_valid, 0, on_divide, received_messages_point, this);
                        
   //combine global and deme resource counts
   const tArray<double> globalAndDeme_resource_count = global_resource_count + deme_resource_count;
   tArray<double> globalAndDeme_res_change = global_res_change + deme_res_change;
   
-  bool task_completed = m_phenotype.TestOutput(ctx, taskctx, globalAndDeme_resource_count, m_rbins, globalAndDeme_res_change, insts_triggered);
+  bool task_completed = m_phenotype.TestOutput(ctx, taskctx, globalAndDeme_resource_count, m_rbins, globalAndDeme_res_change,
+                                               insts_triggered);
   
   //disassemble global and deme resource counts
   global_res_change = globalAndDeme_res_change.Subset(0, global_res_change.GetSize());
@@ -504,7 +511,8 @@
     tArray<double> res_change(resource_count.GetSize());
     tArray<int> insts_triggered;
 
-    cTaskContext taskctx(m_interface, m_input_buf, m_output_buf, other_input_list, other_output_list, false, completed);
+    cTaskContext taskctx(m_interface, m_input_buf, m_output_buf, other_input_list, other_output_list,
+                         m_hardware->GetExtendedMemory(), false, completed);
     m_phenotype.TestOutput(ctx, taskctx, resource_count, m_rbins, res_change, insts_triggered);
     m_interface->UpdateResources(res_change);
     
@@ -517,8 +525,21 @@
   return true;
 }
 
-void cOrganism::NetReset()
+void cOrganism::HardwareReset()
 {
+  if (m_world->GetEnvironment().GetNumStateGrids() > 0) {
+    m_cur_sg = 0; // @TODO - state grid select current
+    
+    const cStateGrid& sg = GetStateGrid();
+    
+    tArray<int> sg_state(3 + sg.GetNumStates(), 0);
+    sg_state[0] = sg.GetInitialX();
+    sg_state[1] = sg.GetInitialY();
+    sg_state[2] = sg.GetInitialFacing();
+    
+    m_hardware->SetupExtendedMemory(sg_state);
+  }
+
   if (m_net) {
     while (m_net->pending.GetSize()) delete m_net->pending.Pop();
     for (int i = 0; i < m_net->received.GetSize(); i++) delete m_net->received[i];

Modified: development/source/main/cOrganism.h
===================================================================
--- development/source/main/cOrganism.h	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/main/cOrganism.h	2008-11-26 06:45:10 UTC (rev 2973)
@@ -85,12 +85,13 @@
 class cLineage;
 class cOrgSinkMessage;
 class cSaleItem;
+class cStateGrid;
 
 
 
 class cOrganism
 {
-protected:
+private:
   cWorld* m_world;
   cHardwareBase* m_hardware;              // The actual machinery running this organism.
   cGenotype* m_genotype;                  // Information about organisms with this genome.
@@ -116,6 +117,8 @@
   tBuffer<int> m_output_buf;
   tBuffer<int> m_received_messages;
   tList<tListNode<cSaleItem> > m_sold_items;
+  
+  int m_cur_sg;
 
   // Communication
   int m_sent_value;         // What number is this org sending?
@@ -147,8 +150,6 @@
   cNetSupport* m_net;
   
   
-  void initialize(cAvidaContext& ctx);
-  
   cOrganism(); // @not_implemented
   cOrganism(const cOrganism&); // @not_implemented
   cOrganism& operator=(const cOrganism&); // @not_implemented
@@ -158,6 +159,19 @@
   cOrganism(cWorld* world, cAvidaContext& ctx, const cGenome& in_genome, cInstSet* inst_set);
   ~cOrganism();
 
+  // --------  Support Methods  --------
+  double GetTestFitness(cAvidaContext& ctx);
+  double CalcMeritRatio();
+  
+  void HardwareReset();
+  
+  void PrintStatus(std::ostream& fp, const cString& next_name);
+  void PrintFinalStatus(std::ostream& fp, int time_used, int time_allocated) const;
+  void Fault(int fault_loc, int fault_type, cString fault_desc="");
+  
+  void NewTrial();
+  
+  
   // --------  Accessor Methods  --------
   void SetGenotype(cGenotype* in_genotype) { m_genotype = in_genotype; }
   cGenotype* GetGenotype() const { return m_genotype; }
@@ -207,7 +221,10 @@
   bool GetPheromoneStatus() { return m_pher_drop; }
   void TogglePheromone() { m_pher_drop = (m_pher_drop == true) ? false : true; }
   void SetPheromone(bool newval) { m_pher_drop = newval; }
+  
+  const cStateGrid& GetStateGrid() const;
 
+  
   // --------  cOrgInterface Methods  --------
   cHardwareBase& GetHardware() { return *m_hardware; }
   cOrganism* GetNeighbor() { return m_interface->GetNeighbor(); }
@@ -247,6 +264,7 @@
   int GetCellData() { return m_interface->GetCellData(); }
   void SetCellData(const int data) { m_interface->SetCellData(data); }  
 
+  
   // --------  Input and Output Methods  --------
   void DoInput(const int value);
   void DoInput(tBuffer<int>& input_buffer, tBuffer<int>& output_buffer, const int value);
@@ -259,18 +277,13 @@
   void DoOutput(cAvidaContext& ctx, const int value);
   //! Check tasks based on the passed-in IO buffers and value (on_divide=false).
   void DoOutput(cAvidaContext& ctx, tBuffer<int>& input_buffer, tBuffer<int>& output_buffer, const int value);  
-
-
-protected:
-  /*! The main DoOutput function.  The DoOutputs above all forward to this function. */
-  void DoOutput(cAvidaContext& ctx, tBuffer<int>& input_buffer, 
-                tBuffer<int>& output_buffer, const bool on_divide, const bool net_valid);
-
-public:
+  
+  
   void ClearInput() { m_input_buf.Clear(); }
   void ResetInput() {m_input_pointer = 0; m_input_buf.Clear(); };
   void AddOutput(int val) { m_output_buf.Add(val); }
 
+  
   // --------  Divide Methods  --------
   bool Divide_CheckViable();
   bool ActivateDivide(cAvidaContext& ctx);
@@ -284,7 +297,6 @@
   bool NetValidate(cAvidaContext& ctx, int value);
   bool NetRemoteValidate(cAvidaContext& ctx, int value);
   int NetLast() { return m_net->last_seq; }
-  void NetReset();
 
   
   // --------  Parasite Interactions  --------
@@ -296,16 +308,6 @@
   void ClearParasites();
   
 
-  // --------  Support Methods  --------
-  double GetTestFitness(cAvidaContext& ctx);
-  double CalcMeritRatio();
-  
-  void PrintStatus(std::ostream& fp, const cString& next_name);
-  void PrintFinalStatus(std::ostream& fp, int time_used, int time_allocated) const;
-  void Fault(int fault_loc, int fault_type, cString fault_desc="");
-
-  void NewTrial();
-
   // --------  Mutation Rate Convenience Methods  --------
   bool TestCopyMut(cAvidaContext& ctx) const { return m_mut_rates.TestCopyMut(ctx); }
   bool TestInsMut(cAvidaContext& ctx) const { return m_mut_rates.TestInsMut(ctx); }
@@ -348,11 +350,12 @@
   double GetNeutralMin() const;
   double GetNeutralMax() const;
 
+  
   // -------- Messaging support --------
-public:
   // Use a deque instead of vector for amortized constant-time removal
   // from the front of the list, to efficiently support message list
   // size caps
+public:
   typedef std::deque<cOrgMessage> message_list_type; //!< Container-type for cOrgMessages.
   
   //! Called when this organism attempts to send a message.
@@ -367,7 +370,7 @@
   //! Returns the list of all messages sent by this organism.
   const message_list_type& GetSentMessages() { InitMessaging(); return m_msg->sent; }
   
-protected:
+private:
   /*! Contains all the different data structures needed to support messaging within
   cOrganism.  Inspired by cNetSupport (above), the idea is to minimize impact on
   organisms that DON'T use messaging. */
@@ -398,7 +401,9 @@
     m_gradient_movement = value;
   }
 
+  
   // -------- BDC Movement ---------
+public:
   void Move(cAvidaContext& ctx);
 
   
@@ -411,6 +416,7 @@
   void SetEventKilled() { killed_event = true; }
   bool GetEventKilled() { return killed_event; }
   
+  
   // -------- Opinion support --------
   /*  Organisms express an opinion at a given point in time.  We can assume that they
    hold this opinion until they express a new one.  The semantics of opinions are
@@ -437,7 +443,7 @@
   //! Return whether this organism has an opinion.
   bool HasOpinion() { InitOpinions(); return m_opinion->opinion_list.size(); }
   
-protected:
+private:
   //! Initialize opinion support.
   inline void InitOpinions() { if(!m_opinion) { m_opinion = new cOpinionSupport(); } }
   //! Container for the data used to support opinions.
@@ -448,6 +454,7 @@
   cOpinionSupport* m_opinion; //!< Lazily-initialized pointer to the opinion data.
   // -------- End of opinion support --------
 	
+  
 	// -------- Synchronization support --------
 public:
   //! Called when a neighboring organism issues a "flash" instruction.    
@@ -455,6 +462,16 @@
   //! Sends a "flash" to all neighboring organisms.
   void SendFlash(cAvidaContext& ctx);
   // -------- End of synchronization support --------	
+
+
+
+	// -------- Internal Support Methods --------
+private:
+  void initialize(cAvidaContext& ctx);
+  
+  /*! The main DoOutput function.  The DoOutputs above all forward to this function. */
+  void doOutput(cAvidaContext& ctx, tBuffer<int>& input_buffer, 
+                tBuffer<int>& output_buffer, const bool on_divide, const bool net_valid);
 };
 
 

Modified: development/source/main/cPhenotype.cc
===================================================================
--- development/source/main/cPhenotype.cc	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/main/cPhenotype.cc	2008-11-26 06:45:10 UTC (rev 2973)
@@ -1138,7 +1138,7 @@
   
   // Update deme merit (guard against running in the test CPU, where there is
   // no deme object.  Don't touch deme merit if there is no deme frac component.
-  cDeme* deme = taskctx.GetOrganism()->GetOrgInterface().GetDeme();
+  cDeme* deme = taskctx.GetOrgInterface()->GetDeme();
   if(deme) {
   
     if (result.GetActiveDeme()) {

Added: development/source/main/cStateGrid.h
===================================================================
--- development/source/main/cStateGrid.h	                        (rev 0)
+++ development/source/main/cStateGrid.h	2008-11-26 06:45:10 UTC (rev 2973)
@@ -0,0 +1,63 @@
+/*
+ *  cStateGrid.h
+ *  Avida
+ *
+ *  Created by David Bryson on 11/25/08.
+ *  Copyright 2008 Michigan State University. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+#ifndef cStateGrid_h
+#define cStateGrid_h
+
+#include "cString.h"
+#include "tArray.h"
+
+
+class cStateGrid
+{
+private:
+  cString m_name;
+  int m_w;
+  int m_h;
+  int m_init_x;
+  int m_init_y;
+  int m_init_facing;
+  int m_num_states;
+  tArray<int> m_grid;
+  
+  cStateGrid(); // @not_implemented
+  cStateGrid(const cStateGrid&); // @not_implemented
+  cStateGrid& operator=(const cStateGrid&); // @not_implemented
+  
+public:
+  cStateGrid(const cString& name, int w, int h, int x, int y, int facing, int num_states, const tArray<int>& grid)
+    : m_name(name), m_w(w), m_h(h), m_init_x(x), m_init_y(y), m_init_facing(facing), m_num_states(num_states), m_grid(grid) { ; }
+  ~cStateGrid() { ; }
+  
+  int GetWidth() const { return m_w; }
+  int GetHeight() const { return m_h; }
+  int GetInitialX() const { return m_init_x; }
+  int GetInitialY() const { return m_init_y; }
+  int GetInitialFacing() const { return m_init_facing; }
+  int GetNumStates() const { return m_num_states; }
+  
+  int GetStateAt(int x, int y) const { return m_grid[x * m_w + y]; }
+};
+
+#endif

Modified: development/source/main/cTaskContext.h
===================================================================
--- development/source/main/cTaskContext.h	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/source/main/cTaskContext.h	2008-11-26 06:45:10 UTC (rev 2973)
@@ -37,9 +37,6 @@
 #ifndef tHashTable_h
 #include "tHashTable.h"
 #endif
-#ifndef cOrganism_h
-#include "cOrganism.h"
-#endif
 
 class cTaskEntry;
 class cTaskState;
@@ -53,6 +50,7 @@
   const tBuffer<int>& m_output_buffer;
   const tList<tBuffer<int> >& m_other_input_buffers;
   const tList<tBuffer<int> >& m_other_output_buffers;
+  const tArray<int>& m_ext_mem;
   bool m_net_valid;
   int m_net_completed;
   tBuffer<int>* m_received_messages;
@@ -65,19 +63,21 @@
 
   cTaskEntry* m_task_entry;
   tHashTable<void*, cTaskState*>* m_task_states;
-
-  cOrganism* m_organism;
   
+  cOrganism* m_org;
+  
+  
 public:
   cTaskContext(cOrgInterface* interface, const tBuffer<int>& inputs, const tBuffer<int>& outputs,
                const tList<tBuffer<int> >& other_inputs, const tList<tBuffer<int> >& other_outputs,
-               bool in_net_valid, int in_net_completed, bool in_on_divide = false,
-               tBuffer<int>* in_received_messages = NULL, cOrganism* org=0)
+               const tArray<int>& ext_mem, bool in_net_valid, int in_net_completed, bool in_on_divide = false,
+               tBuffer<int>* in_received_messages = NULL, cOrganism* org = NULL)
     : m_interface(interface)
     , m_input_buffer(inputs)
     , m_output_buffer(outputs)
     , m_other_input_buffers(other_inputs)
     , m_other_output_buffers(other_outputs)
+    , m_ext_mem(ext_mem)
     , m_net_valid(in_net_valid)
     , m_net_completed(in_net_completed)
     , m_received_messages(in_received_messages)
@@ -85,16 +85,18 @@
     , m_on_divide(in_on_divide)
     , m_task_entry(NULL)
     , m_task_states(NULL)
-    , m_organism(org)
+    , m_org(org)
   {
 	  m_task_value = 0;
   }
   
+  inline cOrgInterface* GetOrgInterface() { return m_interface; }
   inline int GetInputAt(int index) { return m_interface->GetInputAt(index); }
   inline const tBuffer<int>& GetInputBuffer() { return m_input_buffer; }
   inline const tBuffer<int>& GetOutputBuffer() { return m_output_buffer; }
   inline const tList<tBuffer<int> >& GetNeighborhoodInputBuffers() { return m_other_input_buffers; }
   inline const tList<tBuffer<int> >& GetNeighborhoodOutputBuffers() { return m_other_output_buffers; }
+  inline const tArray<int>& GetExtendedMemory() const { return m_ext_mem; }
   inline bool NetIsValid() const { return m_net_valid; }
   inline int GetNetCompleted() const { return m_net_completed; }
   inline tBuffer<int>* GetReceivedMessages() { return m_received_messages; }
@@ -107,9 +109,9 @@
   inline void SetTaskEntry(cTaskEntry* in_entry) { m_task_entry = in_entry; }
   inline cTaskEntry* GetTaskEntry() { return m_task_entry; }
   
+  inline cOrganism* GetOrganism() { return m_org; }
+  
   inline void SetTaskStates(tHashTable<void*, cTaskState*>* states) { m_task_states = states; }
-
-  inline cOrganism* GetOrganism() { return m_organism; }
   
   inline cTaskState* GetTaskState()
   {
@@ -118,7 +120,6 @@
     return ret;
   }
   inline void AddTaskState(cTaskState* value) { m_task_states->Add(m_task_entry, value); }
-  inline cOrgInterface* GetOrgInterface() { return m_interface; }
 };
 
 

Modified: development/tests/hoarding_instn_analyze/test_list
===================================================================
--- development/tests/hoarding_instn_analyze/test_list	2008-11-25 18:02:08 UTC (rev 2972)
+++ development/tests/hoarding_instn_analyze/test_list	2008-11-26 06:45:10 UTC (rev 2973)
@@ -14,7 +14,7 @@
 
 [consistency]
 enabled = yes            ; Is this test a consistency test?
-long = no                ; Is this test a long test?
+long = yes               ; Is this test a long test?
 
 [performance]
 enabled = no             ; Is this test a performance test?




More information about the Avida-cvs mailing list