Author Topic: Another bug fixed by Bau  (Read 2780 times)

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Another bug fixed by Bau
« 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

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Another bug fixed by Bau
« Reply #1 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.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Another bug fixed by Bau
« Reply #2 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

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Another bug fixed by Bau
« Reply #3 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)
« Last Edit: August 09, 2005, 07:31:44 PM by Endy »