Author Topic: My List of errors and fixes  (Read 3401 times)

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
My List of errors and fixes
« on: June 16, 2005, 07:36:45 PM »
You can eather

A. Keep my fix , or

B. Write your own fix if you think my method is too drastic

[you]The areas in bold are the changed areas[/you]

#1 Beggining was returning After the Bounds of the erray

Quote
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
      If UBound(DNA) <= k Then
       DNA(UBound(DNA)).tipo = 4
       DNA(UBound(DNA)).value = 4
       k = UBound(DNA)
      End If

  If beginning > 0 Then
    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
      If UBound(DNA) <= k Then
       DNA(UBound(DNA)).tipo = 4
       DNA(UBound(DNA)).value = 4
       k = UBound(DNA)
      End If

    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

#2 A robot was dumping more then an integer of energy into its child

Quote
Public Sub updatepos()
...
bypass:
      Set nd = rlist.nextnode(nd)
    End With
    DoEvents
  Wend
 
  '''''''''''''''''''''''''''''''''''''''''''''
  '''''''''''''''''''''''''''''''''''''''''''''
  t = 1
  While t < rp
    If rep(t) > 0 Then
      Dim nomore As Long
      nomore = rob(rep(t)).mem(repro) + rob(rep(t)).mem(mrepro)
      If nomore < 32000 Then
      Reproduce rep(t), CInt(nomore)
      rob(rep(t)).mem(repro) = 0
      rob(rep(t)).mem(mrepro) = 0
      Else
      KillRobot rep(t)
      End If

     ElseIf rep(t) < 0 Then
      SexReproduce -rep(t), -rep(t + 1)
      rob(-rep(t)).mem(sexrepro) = 0
      rob(-rep(t + 1)).mem(sexrepro) = 0
      t = t + 1
    End If
    t = t + 1
  Wend
  t = 1
  While t < kl
    KillRobot kil(t)
    t = t + 1
  Wend
...

#3 Although there is a check if the resulting number is greater then integer, This still does not prevent the numbers to be multiplyed as integers Therefore,

Quote
Public sub newshot
...
about 200 body to equal old method range. 32000 body doubles old range
    Shots(a).nrg = Shots(a).range
  Else
    Shots(a).range = RobSize * 3 * rngmultiplier
    Shots(a).nrg = RobSize * 3 * rngmultiplier
  End If
  If shottype = -7 Then
    Dim tempa As Single
    tempa = CLng(rob(n).mem(338)) * 20 'MUST BE CLNG TO FIX THE ERROR
    If tempa <= 32000 Then
      Shots(a).nrg = rob(n).mem(338) * 20
    Else
      KillRobot n
    End If
    Shots(a).range = Shots(a).nrg
    Shots(a).color = vbCyan
  End If
  Shots(a).value = val
...

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
My List of errors and fixes
« Reply #1 on: June 20, 2005, 11:21:16 PM »
Could you explain more about the bots being allowed to dump more than integer of nrg into the babies. I'm kind of curious from an evolution point of view, if the bots could have "intentionally" used this to increase population numbers.

Did you(or anyone else) figure out the junkdna/free nrg bug? Could it have something to do with the (old?) cost deduction based on dna size? I could imagine the dna size going negative and the cost becomming a gain; there's probably some restriction here, I'm not a "real" programer or anything.

Endy B)
« Last Edit: June 20, 2005, 11:24:02 PM by Endy »

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
My List of errors and fixes
« Reply #2 on: June 21, 2005, 08:31:16 AM »
Don't think it could be that.
The charge would have been 1 point per item in the DNA array. It couldn't ever get negative unless someone added code to it to deduct points for junk DNA. And since junk DNA is indistinguishable from normal DNA that wouldn't work too well either.
This charge was dropped a long time ago as it wasn't working correctly anyway.

Also I haven't been able to reproduce the effect on the "official" sourcecode.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D