Author Topic: Insertion mutations not working properly RESOLVED 2.43.1i  (Read 2548 times)

Offline Peksa

  • Bot Destroyer
  • ***
  • Posts: 118
    • View Profile
Insertion mutations not working properly RESOLVED 2.43.1i
« on: April 06, 2008, 08:29:51 PM »
I noticed that there are some VOIDs in mutated DNA in my bots and they seem to be connected to insertion mutations inserting more than one bp per mutation.
« Last Edit: April 11, 2008, 01:50:22 PM by EricL »

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Insertion mutations not working properly RESOLVED 2.43.1i
« Reply #1 on: April 11, 2008, 02:09:29 PM »
Okay.  I've walked through the insertion mutation logic in some detail.  The bottom line is that insertion mutations appear to have been totally broken for any insertion length greater than 1 for a very long time.  Surprisingly, you are probably the first person to notice this becuase you have modified the default insertion mutation length for your bots to something greater than 1.

There were several bugs here:
1) The voids you are seeing are a result of the MakeSpace() routine making space for an insertion (it inserts a sequence of base pairs with type and value of -1, which translates to VOID in the parser code) but the actual insertion occcurring in the wrong place.  This was due to a problem with calling ChangeDNA() from the insertion routine.  The code mistakenly added the legnth of the insertion to the location at which to make the change, so the change was actually being made *after* the space created by MakeSpace().
2) But, there was also an off-by-one error in the code calling ChangeDNA(), so that for insertions of length 1, the code actually did the right thing and did the insertion in the correct place!  Sometimes, two wrongs do make a right.
3) The value of the bp was being mutated before the type.  This only worked in the first place because the insertion was off by 1 (otherwise the old type would be -1).  The code here always sets the value to 1 when the type is mutated, which woudl overwrite the previous value mutation, so this means that the only insertion mutations we were getting were to the first base pair in each bp type.

Fixed in 2.43.1i
« Last Edit: April 11, 2008, 02:13:13 PM by EricL »
Many beers....