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

barrick at myxo.css.msu.edu barrick at myxo.css.msu.edu
Fri Aug 10 07:34:10 PDT 2007


Author: barrick
Date: 2007-08-10 10:34:10 -0400 (Fri, 10 Aug 2007)
New Revision: 1923

Modified:
   development/source/cpu/cHardwareBase.cc
Log:
Bug fix: slip mutations givine zero length organisms

Modified: development/source/cpu/cHardwareBase.cc
===================================================================
--- development/source/cpu/cHardwareBase.cc	2007-08-10 03:38:13 UTC (rev 1922)
+++ development/source/cpu/cHardwareBase.cc	2007-08-10 14:34:10 UTC (rev 1923)
@@ -153,8 +153,10 @@
   if ( organism->TestDivideSlip(ctx) )
   {
     cGenome child_copy = cGenome(child_genome);
+    
+    //All combinations except beginning to past end allowed
     int from = ctx.GetRandom().GetInt(child_copy.GetSize()+1);
-    int to = ctx.GetRandom().GetInt(child_copy.GetSize()+1);
+    int to = (from == 0) ? ctx.GetRandom().GetInt(child_copy.GetSize()) : ctx.GetRandom().GetInt(child_copy.GetSize()+1);
     
     //Resize child genome
     int insertion_length = (from-to);




More information about the Avida-cvs mailing list