[Avida-cvs] [Avida2-svn] r326 - in trunk/source: cpu main

matt@myxo.css.msu.edu matt at myxo.css.msu.edu
Wed Sep 28 11:51:30 PDT 2005


Author: matt
Date: 2005-09-28 14:51:30 -0400 (Wed, 28 Sep 2005)
New Revision: 326

Modified:
   trunk/source/cpu/nHardware.h
   trunk/source/main/cAnalyzeGenotype.cc
Log:
Allow for non-environment-stored instruction sets to be used
once more for recalculating genotypes.


Modified: trunk/source/cpu/nHardware.h
===================================================================
--- trunk/source/cpu/nHardware.h	2005-09-22 23:51:59 UTC (rev 325)
+++ trunk/source/cpu/nHardware.h	2005-09-28 18:51:30 UTC (rev 326)
@@ -24,7 +24,7 @@
   
   static const int STACK_SIZE = 10;
   static const int IO_SIZE = 3;
-};
+}
 
 enum tFaultTypes {
   FAULT_TYPE_WARNING = 0,

Modified: trunk/source/main/cAnalyzeGenotype.cc
===================================================================
--- trunk/source/main/cAnalyzeGenotype.cc	2005-09-22 23:51:59 UTC (rev 325)
+++ trunk/source/main/cAnalyzeGenotype.cc	2005-09-28 18:51:30 UTC (rev 326)
@@ -14,7 +14,7 @@
 #include "organism.hh"
 #include "phenotype.hh"
 #include "cTestCPU.h"
-
+#include "cEnvironment.h"
 using namespace std;
 
 //////////////////////
@@ -165,11 +165,17 @@
   test_info.TestThreads();
   // test_info.TraceTaskOrder();
 
-  // Use the inst lib for this genotype...
-  cInstSet * inst_set_backup = cTestCPU::GetInstSet();
+  // Use the inst lib for this genotype... and syncrhonize environment
+  cInstSet * inst_set_backup   = cTestCPU::GetInstSet();
   cTestCPU::SetInstSet(&inst_set);
+  cInstSet env_inst_set_backup = cTestCPU::GetEnvironment()->GetInstSet();
+  cTestCPU::GetEnvironment()->GetInstSet() = inst_set;
+
   cTestCPU::TestGenome(test_info, genome);
+  
+  // Restore test CPU and environment instruction set
   cTestCPU::SetInstSet(inst_set_backup);
+  cTestCPU::GetEnvironment()->GetInstSet() = env_inst_set_backup;
 
   viable = test_info.IsViable();
 




More information about the Avida-cvs mailing list