Author Topic: Survival-of-the-fittest evobot  (Read 16294 times)

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Survival-of-the-fittest evobot
« Reply #15 on: February 15, 2006, 03:18:15 PM »
re: veggie pop control

Quote
Try this little veggie out. It is a version of Alga minimalis fitted with a randomized reproduction level.
will do ... sounds like a good idea
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Survival-of-the-fittest evobot
« Reply #16 on: February 22, 2006, 09:57:11 PM »
Quote
how do you go about seeing these changes, endy?
do you do periodic saves of all the bots?
or let it run for a period of time and then go in and look at
some of the mutated ones?
I haven't been able to find a good way to recognize and 'capture'
the bots that evlove.
what do you base your selection on?
age + offspring + energy ?????
without having to sort thru hundreds of saved bots?

Sorry took so long. The night before the boat pulled out our free internet died :sad2:

Anyhow, normally I'll look closest at any mutant KingBots after the sim has been running awhile, any large groups of mutant bots with the same coloration, and any just plain weird/interesting bots.

If they're the king and it's been some massive number of cycles, chances are that they're a superior species; well adapted to their local enviroment.

If I see a new offshoot group start growing in numbers I try to see if they have a particularly useful mutation that makes it likely they'll continue to grow in numbers.

Anything that's just plain weird I'll either wait and see how the bot does on its own, or save it's dna and restart with it instead. You can sort of artificially select for the more interesting traits(if you artificially select artificial dna, exactly what are you doing? :D )

You can sort of track general family lines with the first two. A very brief snapshot of the whole species but well worth the look.

Anything oddball I see the bots doing I'll try and recreate it in a more stable manner. Works out pretty well adapting what evolution has found and trimming out the negative mutations.
« Last Edit: February 22, 2006, 10:02:43 PM by Endy »

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Survival-of-the-fittest evobot
« Reply #17 on: February 24, 2006, 08:21:00 PM »
I see Endy has added some info on Evolution Bots/Sims and how to go
about selecting or finding bots that have evolved to the Wiki:
http://www.darwinbots.com/WikiManual/index...=Evolution_Sims

question about the "king bot" ...

where might one find the code in DB that selects the "King Bot"?
I am wondering what criteria it uses to do so ...
age, number of offspring, energy ... ???
and how one might go about altering that ...
how to set up a 'custom' selection from within
the program.

and ... might something like this also be possible with scripts?

iow, if I want to find the bot that has the most offspring, or most kills,
or mutations or has reached the greatest age, or energy, or any
combination ... the various 'data point' perhaps somehow weighted ...
how might this be done?

thanks
不知
~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
Survival-of-the-fittest evobot
« Reply #18 on: February 24, 2006, 08:40:47 PM »
The program uses most offspring as the criteria.  I agree that it would be nice to be able to set up different criteria, however this isn't quite as trivial as you might think.

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Survival-of-the-fittest evobot
« Reply #19 on: February 25, 2006, 08:25:01 AM »
Quote
The program uses most offspring as the criteria.  I agree that it would be nice to be able to set up different criteria, however this isn't quite as trivial as you might think.
ok
but I don't know what to think one way or the other as
I don't know where the code is and so haven't been able
to take a look at it.
so ...
let me ask again:
where in the DB code might this be found?
what form/modual?
or what variable is being used for #of offspring?
perhaps I can search for it using that.

and ...
PY mentioned using scripts ...
like having the program pause when a bot developed
some trait he was looking for.
I wonder if he, or anyone, can offer/share some of these
scripts and how one might go about utilizing them in DB.

thanks
不知
~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
Survival-of-the-fittest evobot
« Reply #20 on: February 25, 2006, 01:37:47 PM »
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.

Offline Old Henk

  • Bot Destroyer
  • ***
  • Posts: 229
    • View Profile
Survival-of-the-fittest evobot
« Reply #21 on: February 25, 2006, 01:46:14 PM »
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
« Last Edit: February 25, 2006, 01:46:41 PM by Henk »

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Survival-of-the-fittest evobot
« Reply #22 on: February 25, 2006, 06:00:00 PM »
Quote
A while ago I suggested some additions to the script-system here
yes. those would be nice.

anyone know where in the DB code these might be found/modified?
不知
~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
Survival-of-the-fittest evobot
« Reply #23 on: February 25, 2006, 06:00:56 PM »
Most of the script code is in scripts.bas

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Survival-of-the-fittest evobot
« Reply #24 on: February 25, 2006, 06:07:57 PM »
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.
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: [Select]
' 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
and this score function:
Code: [Select]
' 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
« Last Edit: February 25, 2006, 06:09:43 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
Survival-of-the-fittest evobot
« Reply #25 on: February 25, 2006, 06:35:45 PM »
Yes, that's the fittest bot function.

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Survival-of-the-fittest evobot
« Reply #26 on: February 25, 2006, 06:44:26 PM »
Quote
Yes, that's the fittest bot function.
yeah great.
so how's it work? ;)
if score is based on # or offspring ...
what's this InvestedEnergy(t) about?

and I don't see where score enters into the fittest Function ...
all I see there is score(t, 1, 2, 0) ...
so how does the 'score' from the score Function get to that?

you saw the page on the wiki ...
http://www.darwinbots.com/WikiManual/index...e=Talk:King_Bot
can someone give some hints or clues there as to how this code works ..
and what one might do to alter how the score it calculated?
how to possibly add weighted values for say, kills, age, energy, or some
other criteria?

tnx
« Last Edit: February 25, 2006, 06:49:53 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
Survival-of-the-fittest evobot
« Reply #27 on: February 25, 2006, 08:00:32 PM »
I've written something in the wiki.

To reiterate:

Quote
When I found this code several months ago (probably closer to 10 or 11) I wanted to modify it so that the king bot was the bot with the most "invested energy", by which I meant the total energy reserves, body reserves, shell, slime, etc. of it and all its descendants. That is where the InvestedEnergy(t) function came in.

However, for a reason I could never figure out the code didn't work. No bot was ever found to be the king for some reason (no bot was ever highlighted), so I changed InvestedEnergy(t) to return always 1 (and thus go back to the previous behavior of most offspring being King (each offspring is given a score of 1)).

To be honest the function is a mess, one of the few areas of the code (this and ties pretty much) that I have hardly touched to clean up. You can see the chaotic way in which Carlo (I assume it was him) coded much of the code.

The score function itself is recursive (it calls itself), which isn't a bad way to search through a tree (in this case, a phylogenic tree) mind you. However he threw 4 different ideas into a single recursive function. It searches for offspring, highlights offspring, draws family lines, and searches for the oldest ancestor. Granted they're somewhat closely related functions, but recursive functions are a headache enough in and of themselves without 4 different ideas thrown in there.

--Numsgil 17:58, 25 Feb 2006 (MST)

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Survival-of-the-fittest evobot
« Reply #28 on: February 25, 2006, 08:31:26 PM »
Quote
anyone know where in the DB code these might be found/modified?

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.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Survival-of-the-fittest evobot
« Reply #29 on: February 26, 2006, 11:58:58 AM »
Quote
I've written something in the wiki.

To reiterate:

Quote
When I found this code several months ago (probably closer to 10 or 11) I wanted to modify it so that the king bot was the bot with the most "invested energy", by which I meant the total energy reserves, body reserves, shell, slime, etc. of it and all its descendants. That is where the InvestedEnergy(t) function came in.

However, for a reason I could never figure out the code didn't work. No bot was ever found to be the king for some reason (no bot was ever highlighted), so I changed InvestedEnergy(t) to return always 1 (and thus go back to the previous behavior of most offspring being King (each offspring is given a score of 1)).

To be honest the function is a mess, one of the few areas of the code (this and ties pretty much) that I have hardly touched to clean up. You can see the chaotic way in which Carlo (I assume it was him) coded much of the code.

The score function itself is recursive (it calls itself), which isn't a bad way to search through a tree (in this case, a phylogenic tree) mind you. However he threw 4 different ideas into a single recursive function. It searches for offspring, highlights offspring, draws family lines, and searches for the oldest ancestor. Granted they're somewhat closely related functions, but recursive functions are a headache enough in and of themselves without 4 different ideas thrown in there.

--Numsgil 17:58, 25 Feb 2006 (MST)
yeah man.

 
so I'm wondering then why one couldn't simply add additional
weighted data in the Fittest function:

Code: [Select]
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

iow ...
right after s = score(t,1,2,0) ...
is there any reason one couldn't add
s=s+ (that bot's energy or kills or slime; age; mutations)
or whatever one wished to look at, weighted accordingly?
ie ... #of offspring being more/less valuable than mutations
or kills or whatever?

if so ...
can you point me to what variables to call on for those ...
iow ...  
would  rob(t).age , rob(t).Mutations, rob(t).SonNumber, rob(t).Kills ... etc
be what I would look at?

or what you were looking at to add with you Invested Energy?

such ideas as number of offspring/age ... or kills/age might
give one a better idea of fittnes than simply # of offspring ...
or whatever one might wish to look at.

tnx
« Last Edit: February 26, 2006, 12:07:43 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]