Bug Reports

From WikiManual
Jump to: navigation, search

a work in progress.


reviving this bug report page ...
to serve as a template ...
to then document new bug reports/fixes for versions 2.37.6 and 2.4.A ...
before they are incorporated into new Official Versions.
the below changes to 2.34 have been incorporated into 2.37.6
and will be removed from this page ...
although retained in this page's history.
as soon as i find time ...
will add the latest/greatest finds fixes sused out by EricL.

Griztalk 12:50, 19 Mar 2006 (MST)





For DarwinBots version 2.37.4
bug reports here.
be as specific as possible ... incuding the value of variables when possible.
to add them ... click edit above.
bracket your report with <pre> and </pre> and it should show up in a blue box:
like this
click on preview to see it is as you wish it to appear ...
and if so, click on save page
if you can't get it to look just right ... don't sweat it ...
I or someone will come along and clean it up. just provide the info ...
at the END of the page. thank you.
See other Moduals with code in full and bugs/fixes in context.

Overflow in rob(n).mem(refvelup)

runtime error 6. overflow.
Senses Modual
Public Sub lookoccurr routine
The following line gives runtime error 6, Overflow often.
The problem being the ^2 produces a value greater than 32000 for those variables.
 rob(n).mem(refvelscalar) = Sqr(rob(n).mem(refvelup) ^ 2 + rob(n).mem(refveldx) ^ 2) 
 ' how fast is    this robot moving compared to me?

Puroposed fix uses Long integers for rob(n).mem(refvelup) and rob(n).mem(refveldx :
rob(n).mem(refvelscalar) = CInt((CLng(rob(n).mem(refvelup)) ^ 2 + CLng(rob(n).mem(refveldx)) ^2 )^0.5)

see Senses page for complete code and error in context.


Overflow in rob(o).vx

see Senses page for complete code and error in context.

runtime error 6 Overflow
Senses modual
Public Sub lookoccurr
rob(n).mem(refveldx) = (rob(o).vy * Cos(rob(n).aim) + rob(o).vx * Sin(rob(n).aim)) - rob(n).mem(veldx)

hover values:
n = 28   refveldx = 697  rob(n).mem(refveldx)= -31  o = 6 
rob(o).vy = 2107.767  rob(n).aim = 1.415345  
rob(o).vx = 93156.06  rob(n).mem(veldx) = 31

where rob(o).vx overflows.

PY thinks this may be it. He says:
The bots discovered a loophole. I have plugged it and am waiting to see if it finds another one.
The modification is right at the top of "updpos" in the "physics" module.
I changed
With rob(t)
 If t <> moving and not .fixed Then
  Maxspeed = 30 / (.mass / 2) 'Set maximum speed. Absolute max = 60

to

With rob(t)
 If t <> moving Then
  Maxspeed = 30 / (.mass / 2) 'Set maximum speed. Absolute max = 60
This line of code was deliberately preventing fixed robots from having the velocity limits applied to them.
After all they aren't moving so why would they need it.
No more loophole now.

Velocity/Acceleration error

This in the Robots modual, Public Sub updatepos routine.
Replace:
       If .mem(216) <> 0 Then
         .Fixed = True
         .vx = 0
         .vy = 0
       Else
         .Fixed = False
       End If

With:

       If .mem(216) <> 0 Then
         .Fixed = True
       Else
         .Fixed = False
       End If
       if .Fixed then
          .vx = 0
          .vy = 0
          .ax = 0
          .ay = 0
        End If

Since ths fix, PY also discovered the following ...
which we think is at the very source of and contributing to all of the above bugs.

Final Velocity fix ???

The new code/fix:

Maxspeed = 30 / (rob(t).mass / 2)
 totv = Sqr(rob(t).vx ^ 2 + rob(t).vy ^ 2)
 If totv > Maxspeed Then     'top speed limit routine 2 changed faster speeds for lower mass robots
   maxcel = totv / Maxspeed
   rob(t).vx = rob(t).vx / maxcel
   rob(t).vy = rob(t).vy / maxcel
 End If
 Maxspeed = 30 / (rob(k).mass / 2)
 totv = Sqr(rob(k).vx ^ 2 + rob(k).vy ^ 2)
 If totv > Maxspeed Then     'top speed limit routine 2 changed faster speeds for lower mass robots
   maxcel = totv / Maxspeed
   rob(k).vx = rob(k).vx / maxcel
   rob(k).vy = rob(k).vy / maxcel
 End If
See Physics modual Repel subroutine for where it goes in context.
This fix seems to have worked ... I haven't had a runtime error since. Griztalk

Abs(.mem(aimsx)) error

see Robots for complete code and error in context.
In Robots modual ...
Private Sub updvars:
bug ... Abs brackets incorrect.
change:
If Abs(.mem(aimsx) > 1256) Then .mem(aimsx) = 1256 * Sgn(.mem(aimsx)) 'new crash fix?
If Abs(.mem(aimdx) > 1256) Then .mem(aimdx) = 1256 * Sgn(.mem(aimdx))
to
If Abs(.mem(aimsx)) > 1256 Then .mem(aimsx) = 1256 * Sgn(.mem(aimsx)) 'new crash fix?
If Abs(.mem(aimdx)) > 1256 Then .mem(aimdx) = 1256 * Sgn(.mem(aimdx))


Overflow due to Zero length DNA

Mutations modual
Public Function NextElement
Public Function NextElement(ByRef DNA() As block, beginning As Integer, tipo As Integer, value As Integer) 

As Integer
 'takes the input for the first value in a gene and returns the position of the next statement
 'as defined by tipo and value
 Dim k As Integer
 Dim uboundarray As Long
 
 uboundarray = UBound(DNA())
 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
 k = beginning

change:

If beginning > 0 Then ... To: 
If beginning > 0 And beginning < uboundarray Then

to fix the overflow problem caused when a robot has zero DNA length.

   
   While Not (DNA(k).tipo = 4 And DNA(k).value = 4) And Not (DNA(k).tipo = tipo And DNA(k).value = 

value)
     k = k + 1
   Wend
   If Not (DNA(k).tipo = tipo And DNA(k).value = value) Then k = -1
 Else 'beginning wasn't valid
   k = -1
 End If
 
 NextElement = k
End Function


New Simulation error after altering Mutations

NOTE: ... also a fix for version 2.4.6

The bug:

Go into the GUI in a running sim and moving the mutations slider off center (any value)
Click change to return to the simulation. Should run happily
Go back to the GUI options menu and the program will crash with a "type mismatch" error
Mutlab.Caption has to a text value.
Optionsform(code) modual
DispSettings routine
for full code and error in context.
In this IF loop, make this replacement: (replace the Red with the Blue)
 If TmpOpts.MutCurrMult > 1 Then
'MutLab.Caption = (TmpOpts.MutCurrMult) + " X" 
 MutLab.Caption = CStr(TmpOpts.MutCurrMult) + " X"
 Else
   MutLab.Caption = "1/" + Str(2 ^ -MutSlide.value) + " X"
 End If

Next Bug Here