[Avida-SVN] r3071 - development/source/cpu

beckma24 at myxo.css.msu.edu beckma24 at myxo.css.msu.edu
Mon Dec 22 10:41:21 PST 2008


Author: beckma24
Date: 2008-12-22 13:41:21 -0500 (Mon, 22 Dec 2008)
New Revision: 3071

Modified:
   development/source/cpu/cHardwareCPU.cc
   development/source/cpu/cHardwareCPU.h
Log:
Added rotate-to-next-occupied-cell and rotate-to-next-unoccupied-cell instructions

Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc	2008-12-22 03:26:57 UTC (rev 3070)
+++ development/source/cpu/cHardwareCPU.cc	2008-12-22 18:41:21 UTC (rev 3071)
@@ -243,7 +243,9 @@
     tInstLibEntry<tMethod>("rotate-right-one", &cHardwareCPU::Inst_RotateRightOne, nInstFlag::STALL),
     tInstLibEntry<tMethod>("rotate-label", &cHardwareCPU::Inst_RotateLabel, nInstFlag::STALL),
     tInstLibEntry<tMethod>("rotate-to-unoccupied-cell", &cHardwareCPU::Inst_RotateUnoccupiedCell, nInstFlag::STALL),
+    tInstLibEntry<tMethod>("rotate-to-next-unoccupied-cell", &cHardwareCPU::Inst_RotateNextUnoccupiedCell, nInstFlag::STALL),
     tInstLibEntry<tMethod>("rotate-to-occupied-cell", &cHardwareCPU::Inst_RotateOccupiedCell, nInstFlag::STALL),
+    tInstLibEntry<tMethod>("rotate-to-next-occupied-cell", &cHardwareCPU::Inst_RotateNextOccupiedCell, nInstFlag::STALL),
     tInstLibEntry<tMethod>("rotate-to-event-cell", &cHardwareCPU::Inst_RotateEventCell, nInstFlag::STALL),
     
     tInstLibEntry<tMethod>("set-cmut", &cHardwareCPU::Inst_SetCopyMut),
@@ -4410,7 +4412,16 @@
   return true;
 }
 
+bool cHardwareCPU::Inst_RotateNextOccupiedCell(cAvidaContext& ctx) {
+	m_organism->Rotate(1);
+  return Inst_RotateOccupiedCell(ctx);
+}
 
+bool cHardwareCPU::Inst_RotateNextUnoccupiedCell(cAvidaContext& ctx) {
+	m_organism->Rotate(1); // continue to rotate
+  return Inst_RotateUnoccupiedCell(ctx);
+}
+
 bool cHardwareCPU::Inst_RotateEventCell(cAvidaContext& ctx) {
   const int reg_used = FindModifiedRegister(REG_BX);
   

Modified: development/source/cpu/cHardwareCPU.h
===================================================================
--- development/source/cpu/cHardwareCPU.h	2008-12-22 03:26:57 UTC (rev 3070)
+++ development/source/cpu/cHardwareCPU.h	2008-12-22 18:41:21 UTC (rev 3071)
@@ -514,7 +514,9 @@
   bool Inst_RotateRightOne(cAvidaContext& ctx);
   bool Inst_RotateLabel(cAvidaContext& ctx);
   bool Inst_RotateOccupiedCell(cAvidaContext& ctx);
+  bool Inst_RotateNextOccupiedCell(cAvidaContext& ctx);
   bool Inst_RotateUnoccupiedCell(cAvidaContext& ctx);
+  bool Inst_RotateNextUnoccupiedCell(cAvidaContext& ctx);
   bool Inst_RotateEventCell(cAvidaContext& ctx);
   bool Inst_SetCopyMut(cAvidaContext& ctx);
   bool Inst_ModCopyMut(cAvidaContext& ctx);




More information about the Avida-cvs mailing list