[Avida-SVN] r2143 - branches/dkdev/source/cpu

dknoester at myxo.css.msu.edu dknoester at myxo.css.msu.edu
Thu Oct 18 15:40:21 PDT 2007


Author: dknoester
Date: 2007-10-18 18:40:21 -0400 (Thu, 18 Oct 2007)
New Revision: 2143

Modified:
   branches/dkdev/source/cpu/cHardwareCPU.cc
   branches/dkdev/source/cpu/cHardwareCPU.h
Log:
Split region declaration instruction into two parts, removing the math requirement.

Modified: branches/dkdev/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/dkdev/source/cpu/cHardwareCPU.cc	2007-10-18 14:49:10 UTC (rev 2142)
+++ branches/dkdev/source/cpu/cHardwareCPU.cc	2007-10-18 22:40:21 UTC (rev 2143)
@@ -379,6 +379,8 @@
     
     // Two-cells instructions.
     cInstEntryCPU("region", &cHardwareCPU::Inst_Region),
+    cInstEntryCPU("region.up", &cHardwareCPU::Inst_RegionUp),
+    cInstEntryCPU("region.down", &cHardwareCPU::Inst_RegionDown),
     cInstEntryCPU("cell-one.x", &cHardwareCPU::Inst_CellOneX),
     cInstEntryCPU("cell-one.y", &cHardwareCPU::Inst_CellOneY),
     cInstEntryCPU("cell-two.x", &cHardwareCPU::Inst_CellTwoX),
@@ -3808,7 +3810,6 @@
 }
 
 
-
 /*! When called, this instruction latches a "decision" made by this organism.  If
 the value is "true" (one), then the organism is in the region.  If the value is
 "false" (zero), then the organism is not in the region.  We allow standard
@@ -3819,6 +3820,21 @@
   return true;
 }
 
+
+bool cHardwareCPU::Inst_RegionUp(cAvidaContext& ctx) {
+  if(organism->GetCellID() == -1) return false;
+  organism->SetRegion(1);
+  return true;
+}
+
+
+bool cHardwareCPU::Inst_RegionDown(cAvidaContext& ctx) {
+  if(organism->GetCellID() == -1) return false;
+  organism->SetRegion(0);
+  return true;
+}
+
+
 //! Returns the x (er, first) coordinate of the first randomly selected cell.
 bool cHardwareCPU::Inst_CellOneX(cAvidaContext& ctx) {
   if(organism->GetCellID()==-1) return false;

Modified: branches/dkdev/source/cpu/cHardwareCPU.h
===================================================================
--- branches/dkdev/source/cpu/cHardwareCPU.h	2007-10-18 14:49:10 UTC (rev 2142)
+++ branches/dkdev/source/cpu/cHardwareCPU.h	2007-10-18 22:40:21 UTC (rev 2143)
@@ -496,6 +496,8 @@
   
   // Two cells instructions.
   bool Inst_Region(cAvidaContext& ctx);
+  bool Inst_RegionUp(cAvidaContext& ctx);
+  bool Inst_RegionDown(cAvidaContext& ctx);
   bool Inst_CellOneX(cAvidaContext& ctx);
   bool Inst_CellOneY(cAvidaContext& ctx);
   bool Inst_CellTwoX(cAvidaContext& ctx);




More information about the Avida-cvs mailing list