Code center > Bugs and fixes

Another bug fixed by Bau

(1/1)

Botsareus:
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
--- End quote ---

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.
--- End quote ---

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
--- End quote ---

With this:


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


:D Bau

Numsgil:
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.

Botsareus:
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

Endy:
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)

Navigation

[0] Message Index

Go to full version