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

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Unassigned variable when using InstaWin
« on: March 14, 2006, 07:16:57 PM »
Pressing the InstaWin button on the Contest Results dialog in 2.4A (VB version) during a contest results in a crash at line 16 of Contest_Form.frm.  The variable nd is declared but never used or initalized.  Since nd is never used, commenting out the line (t=nd.robn) addresses the problem and appears to result in correct behaviour.

"Doctor, it hurts when I do this."
"Then don't do that."
Many beers....

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Unassigned variable when using InstaWin
« Reply #1 on: March 14, 2006, 07:33:46 PM »
thanks eric.

I ran into that in earlier versions of 2.4

but in 2.4.A ... I haven't been able to get leauges to run ...
crashes anytime I try to create a leauge ...
or to load an existing one, even F1.
I've asked about this a number of times here ... got no reply.
so let me make sure ...
you are able to load and run leauges in 2.4.A, yes?
do they work except for this InstaWin button?

thanks ...
one reason I stopped using 2.4 and went back to 2.37.6 ...
so this may be good news. ;)
« Last Edit: March 14, 2006, 07:37:19 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 Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Unassigned variable when using InstaWin
« Reply #2 on: March 14, 2006, 10:23:17 PM »
I always feel bad working on 2.4 since it postpones the C++ development...

If you'd really like me to I can go through and try to make the leagues work.  To be honest though the code is a mess (I wrote the code I admit, not one of my cleaner hacks).

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Unassigned variable when using InstaWin
« Reply #3 on: March 14, 2006, 10:56:12 PM »
Quote
I always feel bad working on 2.4 since it postpones the C++ development...

If you'd really like me to I can go through and try to make the leagues work.  To be honest though the code is a mess (I wrote the code I admit, not one of my cleaner hacks).
well it sounds like Eric has it working to some degree ...
and is finding/fixing bugs so ... ???

the errors I get may be due to something else ...
I get path errors sometimes ...
and I didn't want to spend more time on it if it wasn't working at all ...
but if he has it up and going ...
then maybe the problem is I don't have all the folders and
league tables in the right place or something.
that he has it working makes it worthwhile for me to play with it again.

so I wouldn't sweat it.
eventually, it would be nice to have ...
as I don't see being able to alter the c++ version myself ...
so the VB programs are more interesting for learning.
maybe we'll keep poking around and figure it out.
不知
~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 #4 on: March 14, 2006, 11:29:41 PM »
Nums, I'd say you should stay focused on the C++ version.  I'm just filing bugs on 2.4A as I find them mostly because I can I guess, just to have a record of them to make sure they get picked up in the C++ fork (yea, I know.  I expect the value of 2.4A bug reports is marginal for the C++ fork given the magnitude of the re-write but what the hey...).  I'm not on a mission to make anything specific (like leagues) work in 2.4 - just fixing crashing bugs at this stage - though if there is high demand to make a specific feature work in 2.4 that used to work in previous versions, I could probably be of some use there.  

I have a pretty fast machine, so it's pretty easy for me to run things in VB all the time and identify/investigate/fix simple things as/when I hit them.   I don't really have to know the code that well to fix simple overflows and such, not in depth and those who do know it like yourself are IMHO better utilized working on the new architecture and the port.   I certainly don't expect any more 'official' work on the VB fork given the focus on C++ and I'd be happy to share my private VB exe with anyone who can't build the post 2.4A cumulative fixes themselves.  I'd also be happy to spend a little bit of time (ephansis on 'little') making specific functionality work in 2.4A if someone really needs something (I really miss the gene activation form for debuigging bots and may spend some time on that this week) but at some point in the not too distant future, I plan to volunteer to help on the C++ version so I don't want to do too much down level....

So, I do think we want to track 2.4A bugs, expecially crashing bugs, but that doesn't mean you or anyone else has to fix them much less make specific features work.  My vote is to keep the big guns full speed ahead on the C++ port.

If someone is dying for something specific to work in 2.4A, let me know and I can spend some time on it, letting Nums work on the real deal.

-E
Many beers....

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Unassigned variable when using InstaWin
« Reply #5 on: March 14, 2006, 11:38:52 PM »
In answer to Griz's specific question about running leagues, well, to be honest, I'm not really sure.  I barely understand what a league is!  I'm still a real Newbie, one who can code (can you say 'dangerous'?) but still really quite the DB newbie.  

What I can do is load a sim with a couple of bots and check the F1 checkbox on the 'Restart and League' page and I get the Contest Results dialog with dynamic population counters.  Very useful that, league or no league.  With my little crahs fix, I can press the Istawin button and not crash.  It seems to play a number of rounds though there are still some quirks.  Sometimes Instawin kills the loosing bots but doesn't start another round for example.  But in particular, I have not played around with (nor do I fully understand yet) the other setttings on the page, including the Challenge league stuff.  Will do tomorrow.
« Last Edit: March 14, 2006, 11:50:56 PM by EricL »
Many beers....

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Unassigned variable when using InstaWin
« Reply #6 on: March 15, 2006, 12:47:03 AM »
ah.
yeah ... that's not the same as loading in a league ...
that's where I get my crash.
will have to try it like you were ... yes that's useful too.

play with it in version 2.37.6 ... as everything works there. I think.
well, I seem to have problems limiting the number of rounds ...
I figured best of 3 was good enough but it always seemed to keep
going longer than that.

I think someone was going to do a page on the wiki on leagues ...
as I'm still not sure how it's supposed to work.
seems you do have to have the league tables in place.
I don't think they come with the later versions ...
you may have to go back to ver 2.34 or something to get them.

maybe a 'search' here for leagues might turn up a message or two
to get you started.  seems I asked when I was starting ...
and now it's been so long I don't recall how to do them anymore. ;)

I ended up making my own leagues ... with just 3 or 4 bots ...
never did play with F1 ... other than just to see if it worked.

that InstaWin fix is good ...
I had that crash too ... probably while doing the same thing as you ...
and with bots that were simply mutations or bots with only slightly
different values in their dna ... they tended to be evenly matched ...
and if left to the contest ... never would select a winner.
so what I did was manually select a winner after a given number of cycles.
it would be nice to have that option work ... stopping the contest
after a given number of cycles.  

try loading F1 league in version 2.4.A ...
the error I got often was some path error.
I never did do it via VB and try to debug.
time!  I need a 36 hour day. ;)

let me know if you discover anything more.
不知
~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 #7 on: March 15, 2006, 10:38:38 AM »
re: League errors in 2.4

ver 2.4.A
trying to load F1 League ...
I get error 9  Subscript out of range

debug takes me to the line in bold in:

Public Function DnaLen(DNA() As block) As Integer
  DnaLen = 1
  While Not (DNA(DnaLen).tipo = 10 And DNA(DnaLen).value = 1)
   DnaLen = DnaLen + 1
  Wend
End Function

where DnaLen = 20
DNA(DnaLen).tipo = <Subscript out of range>
DNA(DnaLen).value =  <Subscript out of range>

so ... ?????????????????


just running under F1 conditions ...
the contest mode works ...
and clicking on InstaWin ...
I get Run-time error '91':
Object variable or With block variable not set.

commenting out  't = nd.robn then takes care of this ...
as Eric1 said.

also encountered the   .mem(837) = .Paracount overflow
and fixed that wih his patch as well.
thanks Eric!

so this is great, as I use this much as eric does ...
to evaluate a few bots with minor differences.
also ... keeping mutations enabled ...
and saving the dna of successful winners ...
one can so a bit of 'evolving' here as well.
it would be nice to be able to save the robots
at the end of each round and have a way to look
at them to find such mutants.

perhaps I can work the Invested Energy King bot thing
into this, using # of offspring along with # of mutations
as the criteria.

we will see
不知
~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 #8 on: March 15, 2006, 10:42:04 AM »
Eric ...
in case you hadn't noticed:
in ver 2.4.A ...
the error.sim save is named differently than in 2.37.6
it is not 'on error go to fine' as it is there.

in:

~~~
' main procedure. Oh yes!
Private Sub main()
  Dim clocks As Long
  clocks = GetTickCount
  Do
    If Active Then
     
      If MDIForm1.ignoreerror = True Then
        On Error Resume Next  
      Else
        'On Error GoTo SaveError  '<uncomment this line for the 'compiled' version>
      End If
~~~

then it will save as error.sim running compiled.
commented out in the VB ... it won't and you can Debug.

hmmmm ...
wondering if we could set this up to be 'toggled' from within the program
so I wouldn't keep forgetting to uncomment it for the compiled version.
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Unassigned variable when using InstaWin
« Reply #9 on: March 15, 2006, 10:52:53 AM »
Quote
re: League errors in 2.4

ver 2.4.A
trying to load F1 League ...
I get error 9  Subscript out of range

debug takes me to the line in bold in:

Public Function DnaLen(DNA() As block) As Integer
  DnaLen = 1
  While Not (DNA(DnaLen).tipo = 10 And DNA(DnaLen).value = 1)
   DnaLen = DnaLen + 1
  Wend
End Function

where DnaLen = 20
DNA(DnaLen).tipo = <Subscript out of range>
DNA(DnaLen).value =  <Subscript out of range>
That's odd.  The code is trying to find the end of the DNA.  ALL DNA, as far as I remember, must end with tipo = 10 and value = 1 (the 'end')

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Unassigned variable when using InstaWin
« Reply #10 on: March 15, 2006, 12:16:48 PM »
Quote
Quote
re: League errors in 2.4

ver 2.4.A
trying to load F1 League ...
I get error 9  Subscript out of range

debug takes me to the line in bold in:

Public Function DnaLen(DNA() As block) As Integer
  DnaLen = 1
  While Not (DNA(DnaLen).tipo = 10 And DNA(DnaLen).value = 1)
   DnaLen = DnaLen + 1
  Wend
End Function

where DnaLen = 20
DNA(DnaLen).tipo = <Subscript out of range>
DNA(DnaLen).value =  <Subscript out of range>
That's odd.  The code is trying to find the end of the DNA.  ALL DNA, as far as I remember, must end with tipo = 10 and value = 1 (the 'end')
looks like ...
and this was an established F1 league ...
obviously one that had been run before ...
not one I made up with my own bots.

will try it again trying to load F2 or make a new league ...
see if the numbers are the same.
what is the significance of DnaLen = 20?

oh well ...
onward

oh yeah ... a question:

did number of rounds ever work?
as I recall, they just keep going on up to 10.
and what is that sampling rate = 10 do/not-do?
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Unassigned variable when using InstaWin
« Reply #11 on: March 15, 2006, 12:38:58 PM »
In order to win a contest, a bot must win Sqr(# rounds) + (rounds / 2)
So a 4-1 record won't win, but a 5-0 one will.

This was chosen way before I joined as being a statistically significant way to judge that one bot is better than another.

DnaLen of 20 is usually a veggy if I remember correctly.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Unassigned variable when using InstaWin
« Reply #12 on: March 15, 2006, 02:02:49 PM »
What the heck is the league function doing looking at DNA length??  :blink:
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 #13 on: March 15, 2006, 03:13:47 PM »
I don't remember to be honest.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Unassigned variable when using InstaWin
« Reply #14 on: March 15, 2006, 03:21:58 PM »
The function that loads the robots (RobScriptLoad) calls DnaLen to set the length in the rob array when the league table is loaded/created.

I think the bug has to do with reuse of rob array elements.  Working on it...
Many beers....