Darwinbots Forum

Code center => Bugs and fixes => Topic started by: Botsareus on August 09, 2005, 12:55:23 PM

Title: Another bug fixed by Bau
Post by: Botsareus on August 09, 2005, 12:55:23 PM
We have little code here in "Public Function NextElement"

Quote
  If DNA(uboundarray).tipo <> 4 And DNA(uboundarray).value <> 4 Then
    ReDim Preserve DNA(uboundarray + 1)
    DNA(uboundarray + 1).tipo = 4
    DNA(uboundarray + 1).value = 4
  End If

I beat what we were tring to do is put an "end" on the end of the dna if there is not any.

What we ended up doing is as follows:

Quote
Only if BOUTH of the values do not equal 4 then change it.

So lets say one of the values is 4 then the program skips right over it.

What we need is: only if not  bouth of the values equal 4 then change it.

Repleace this:

Quote
If DNA(uboundarray).tipo <> 4 And DNA(uboundarray).value <> 4 Then

With this:

Quote
If Not ((DNA(uboundarray).tipo = 4) And (DNA(uboundarray).value = 4)) Then


:D Bau
Title: Another bug fixed by Bau
Post by: Numsgil on August 09, 2005, 02:53:54 PM
Silly me.  You can also just replace the and with an or.

Not really a bug though since DNA should have an end at the end anyway.  The auto end thing is just a precaution.
Title: Another bug fixed by Bau
Post by: Botsareus on August 09, 2005, 04:53:07 PM
Yea more like an error fix for an error fix because without it you will get a subscript out of range in the first 1 hour.

Lets see here: "or"


yeap , use or , I dont see nothing wrong with it.


:P Bau
Title: Another bug fixed by Bau
Post by: Endy on August 09, 2005, 07:30:20 PM
Is this why if you view the dna of bot 0(click robot info with no bot selected), a dead bot, or a end-less dna, you get such weird values? I've tried figuring it out in the past but haven't had much luck. It almost looked like a giant array of values with another bot's, typically veggies, dna at the end.

Endy B)