Code center > Bug reports

Unassigned variable when using InstaWin

<< < (4/5) > >>

PurpleYouko:
Seems a bit weird  :blink:

Were you high on something when you wrote that Num?  B)

Numsgil:
It was the first large project I had tried doing if I remember right.

The basic stuff wasn't too hard, but there were dozens of special cases that needed special code, and it quickly got messy.

I've since gotten better at anticipating coding complexity and forcing myself to design it properly.

Griz:
hey ...
if if always works exactly like you expect it to ...
you never learn how to do anything new.
mistakes is where it's at, man ...
takin' you where you'd never go otherwise. ;)

EricL:
Okay.  I traced Griz's DNALen out of range bug to the function League_Eyefudge in F1Mode.bas.  It adds a fake gene to the end of a bot in F1 mode so that the combatents don't have the same number of .eye statements.  

It's a huge hack (which the author well knew given the comments in the code and the name of the routine -  IMHO, bots should have and use GUIDs for species identification in the future) but the routine as it is is inadvertedly overwriting the end of the DNA and thus removing the tipo = 10, value = 1 at the end of the DNA casuing the run off in DNALen().

Changing lines 538 adn 539 in F1Mode.bas from


--- Code: ---rob(robotnumber).DNA(t).tipo = 4
rob(robotnumber).DNA(t).value = 4
--- End code ---

to the following:


--- Code: ---rob(robotnumber).DNA(t).tipo = 10
rob(robotnumber).DNA(t).value = 1
--- End code ---

fixes that specific issue.  The DNA will now be terminated correctly and DNALen will work properly without walking off the end of the DNA array.

To be sure, there are still a bunch of issues with leagues, but this fixes Griz's crash.

Numsgil:
Thanks for fixing it.

The Eyefudge thing was something that seemed like a good idea when I started but quickly became unwieldly.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version