Bots and Simulations > Evolution and Internet Sharing Sims

Survival-of-the-fittest evobot

<< < (5/11) > >>

Numsgil:
You might look in Form1.  I know it's not in any of the modules I pulled out of form1 (Robots.bas, etc.), beyond that I'm not really sure.  It took me a long time to find myself.

Scripts should be accessible from the scripts tab in the settings.  I haven't played with the much myself beyond killing bots if they lose .repro.

Old Henk:
The script system is actually still in very basic and early in it's development. The scripts that are now possible are quite limited in their ability. PY is planning on expanding this system, I believe.

A while ago I suggested some additions to the script-system here

Griz:

--- Quote ---A while ago I suggested some additions to the script-system here
--- End quote ---
yes. those would be nice.

anyone know where in the DB code these might be found/modified?

Numsgil:
Most of the script code is in scripts.bas

Griz:

--- Quote ---You might look in Form1.  I know it's not in any of the modules I pulled out of form1 (Robots.bas, etc.), beyond that I'm not really sure.  It took me a long time to find myself.

Scripts should be accessible from the scripts tab in the settings.  I haven't played with the much myself beyond killing bots if they lose .repro.
--- End quote ---
did a search of all moduals using * .SonNumber *
with not much luck and somehow stumbled upon a 'fittest bot' function ...
which talks about scoring ...
might this have something to do with it?
or the score function that follows?



--- Code: ---' returns the fittest robot (selected through the score function)
' altered from the bot with the most generations
' to the bot with the most invested energy in itself and children
Function fittest() As Integer
  Dim t As Integer
  Dim s As Double
  Dim Mx As Double
  Mx = 0
  For t = 1 To MaxRobs
    If rob(t).Exist And Not rob(t).Veg Then
      s = score(t, 1, 2, 0)
      If s >= Mx Then
        Mx = s
        fittest = t
      End If
    End If
  Next t
End Function
--- End code ---
and this score function:

--- Code: ---' does various things: with
' tipo=0 returns the number of descendants for maxrec generations
' tipo=1 highlights the descendants
' tipo=2 searches up the tree for eldest ancestor, then down again
' tipo=3 draws the lines showing kinship relations
Function score(ByVal r As Integer, ByVal reclev As Integer, maxrec As Integer, tipo As Integer) As Double
  Dim al As Integer
  Dim dx As Single
  Dim dy As Single
  Dim cr As Long
  Dim ct As Long
  Dim t As Integer
  If tipo = 2 Then plines (r)
  score = 0
  For t = 1 To MaxRobs
    If rob(t).Exist Then
      If rob(t).parent = rob(r).AbsNum Then
        If reclev < maxrec Then score = score + score(t, reclev + 1, maxrec, tipo)
        score = score + InvestedEnergy(t)
        If tipo = 1 Then rob(t).highlight = True
        If tipo = 3 Then
          dx = (rob(r).pos.x - rob(t).pos.x) / 2
          dy = (rob(r).pos.y - rob(t).pos.y) / 2
          cr = RGB(128, 128, 128)
          ct = vbWhite
          If rob(r).AbsNum > rob(t).AbsNum Then
            cr = vbWhite
            ct = RGB(128, 128, 128)
          End If
          Line (rob(t).pos.x, rob(t).pos.y)-Step(dx, dy), ct
          Line -(rob(r).pos.x, rob(r).pos.y), cr
        End If
      End If
    End If
  Next t
  If tipo = 1 Then
    Form1.Cls
    DrawAllRobs
  End If
End Function
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version