Author Topic: Unassigned variable when using InstaWin  (Read 7526 times)

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Unassigned variable when using InstaWin
« Reply #15 on: March 15, 2006, 03:55:37 PM »
Seems a bit weird  :blink:

Were you high on something when you wrote that Num?  B)
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Unassigned variable when using InstaWin
« Reply #16 on: March 15, 2006, 05:00:21 PM »
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.

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Unassigned variable when using InstaWin
« Reply #17 on: March 15, 2006, 05:09:49 PM »
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. ;)
« Last Edit: March 15, 2006, 05:10:35 PM by Griz »
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Unassigned variable when using InstaWin
« Reply #18 on: March 15, 2006, 06:38:10 PM »
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: [Select]
rob(robotnumber).DNA(t).tipo = 4
rob(robotnumber).DNA(t).value = 4

to the following:

Code: [Select]
rob(robotnumber).DNA(t).tipo = 10
rob(robotnumber).DNA(t).value = 1

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.
Many beers....

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Unassigned variable when using InstaWin
« Reply #19 on: March 15, 2006, 11:30:27 PM »
Thanks for fixing it.

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

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Unassigned variable when using InstaWin
« Reply #20 on: March 16, 2006, 12:30:06 AM »
Reminds me of an old girlfriend...   :D
Many beers....

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Unassigned variable when using InstaWin
« Reply #21 on: March 16, 2006, 07:17:53 AM »
Quote
Reminds me of an old girlfriend...   :D
LOL  :lol:
so ...
just how old was she? ;)

hey ...
thanks Eric ...
will get this thing finetuned yet.
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Unassigned variable when using InstaWin
« Reply #22 on: March 16, 2006, 07:35:04 AM »
Quote
Changing lines 538 adn 539 in F1Mode.bas from

I do find the lines in Public Function League_Eyefudge

'end
    rob(robotnumber).DNA(t).tipo = 4
    rob(robotnumber).DNA(t).value = 4

I assume these are the lines you refer to ...
but ...
don't know where you guys get your line numbers from in VB
I don't find them ...
where they be?
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Unassigned variable when using InstaWin
« Reply #23 on: March 16, 2006, 10:49:16 AM »
Those be the lines.  In VB 6, the line and column numbers of where the cursor is located are displayed to the right of the standard toolbar.

And she swore she was over 18...  Perhaps I should have said it reminds me of my current marriage.  Oh, hey, did I type that outloud?
Many beers....