Bots and Simulations > Evolution and Internet Sharing Sims

Survival-of-the-fittest evobot

<< < (7/11) > >>

Griz:

--- Quote ---
--- Quote ---anyone know where in the DB code these might be found/modified?
--- End quote ---

Scripts are kind of interesting to set up.

The biggest problem I always come up against is that every robot has to parse every script in the active script list every time that they need to test the conditions against them.

This was relatively easy to set up for mutations because you only need to parse the scripts when a baby is born but for scripts in the main code, eaxh bot would have to check them all on every cycle and this could possibly cause a bit of a slowdown.

Then again maybe it ouldn't be all that bad.

Right now scripts are only parsed in the mutations module but expansions to the system will have to be called from the main code loop.
--- End quote ---
ok.

can you give me an example or two of some of the ones you
are using to pause the sim when some mutation you have
flagged is detected?
and how one would go about adding new scripts?

this seems a very powerful tool to me.

thanks

Griz:
question:
how does this determining the Fittest used to hightlight the King Bot?
where does that happen?


--- Code: ---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 code ---

'fittest' is now set to 't' ...
so now 'fittest' must be used somewhere to hightlight the bot, eh?
wouldn't rob(t).highlight = True have to also be set here ...
and not in the ScoreFunction?
what is being highlighted in ScoreFunction when tipo=1?
is that something different?

this is all very confusing. ;(

Numsgil:

--- Quote ---this is all very confusing. ;(
--- End quote ---
Welcome to the club :D

If you can tinker around and get something more interesting than simply the most number of offspring, be my guest.

Griz:
it works. :D

I commented out the s=score(t,1,2,0) and just went with
s = rob(t).SonNumber and it seemed to workthe same
as before.
then used s=rob(t).SonNumber / rob(t).age ...
which I think would select a bot with a higher 'rate of reproduction'
which may be useful, who can say.  
so it looks like this will work, and you can put in whatever
criteria you want for sellecting what you might consider to be a
more fit bot.

found your Invested Energy routine and put part of it in here.
of course this only calculates that invested in the bot itself, not that
invested in it's offspring ...
and I guess that was what you were really looking for.
I will think on that a bit now that this is beginning to make some sense.
but it can at least be a factor for the bot itself.
I did scale it way down tho ...
knocking energy down by a factor of 1000 and body by 100
so I could still add in number of offspring, multiplied by 10 ...
and have all of these be factors of a similar magnitude.
the scaling of course can be altered any way one wishes.

so the line
s = rob(t).SonNumber * 10 + rob(t).nrg / 1000 + rob(t).body / 100

works pretty good, as energy can easily get up to 32000 and body
pretty high as well, not sure what the max is, I saw values of 1200 ...
so right there s = 44. but as soon as some begin reproducing ...
then # of offspring begins to come into play.
so this is what I was looking for ... a way to scale various inputs.

of course ... it should be possible to enable/disable and scale
many different inputs from an input window ...
but at this point I haven't any idea how to do so. ;)
any info to steer me towards how one might do that will be appreciated.

anyway Nums ...
looks you can put your Invested Energy into the equation here
in this limited way ... and add a nominal value for each offspring.
 
I will play with it the way you had it set up, before defaulting it to one ...
and see what I can sus out.


--- Code: ---' returns the fittest robot (selected through the score function)  'not any more - griz
' 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 s1 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) ' old scoring

      's = rob(t).SonNumber / rob(t).age      '# of offspring/age

      s = rob(t).SonNumber * 10 + rob(t).nrg / 1000 + rob(t).body / 100  'Num's Invested Energy plus #offspring ... all scaled

        If s >= Mx Then 'NOTE when higher = fittest
        'If s <=Mx Then 'when lower values = fittest    
        Mx = s
        fittest = t
                  'just for debugging info
                   's1 = rob(fittest).nrg  s1 = rob(fittest).body s1 = rob(fittest).SonNumber
                   's1 = rob(fittest).age s1 = rob(fittest).AbsNum
        
      End If
    End If
  Next t
End Function
--- End code ---

Numsgil:
The only thing to watch out for:

The original function added the total number of descendants.  That means it searched through the bots' children's children, on and on...

Unless I'm mistaken your function would only take the immediate children into consideration.

Still, nice work.  I appreciate the effort.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version