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

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Survival-of-the-fittest evobot
« on: February 14, 2006, 05:15:57 PM »
Had an idea for a new Evotbot.

The bot spends about 1000 cycles building up 20000 energy. It then fixes.
When it's fixed it spins and repros uncontrollably (and dies), producing many, many offspring.
All the offspring compete to the death and the fittest few survive. Lame bots do not survive.

I'm doing some fine tuning at the moment. Here's the prototype so far:

Code: [Select]
' Shoot
cond
*.eye5 0 !=
start
-6 .shoot store
stop

' Move
cond
*.eye5 0 !=
start
20 .up store
stop

' Spin
cond
*.eye5 0 =
start
314 rnd .aimdx store
stop

' Activate repro mode!
cond
*.nrg 20000 >
start
1 .fixpos store
stop

' Repro and spin ... get dizzy ...
cond
*.fixed 0 !=
start
314 rnd .aimdx store
10 .repro store
32000 .tielen1 store
stop

' Unfix if fixed and not at repro age
cond
*.fixed 0 !=
*.robage 1000 <
start
.fixpos dec
stop

end

Feel free to have a play around and see if you can get any good results  :D

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
    • http://community.webshots.com/user/objack2
Survival-of-the-fittest evobot
« Reply #1 on: February 14, 2006, 05:58:48 PM »
one could create a few bots with initial different # of cycles for storing before repro ...
a shorter number of cycles giving a quicker turnover, with fewer offspring ...
have a cycles/energy of 500/10000, 750/15000, 1000/20000, 1250/25000, etc ...
and run them against one another, perhaps in a league situation to see
which species has more staying power, rather than the hightest population.
looking for the ideal balance point.
« Last Edit: February 14, 2006, 06:01:27 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 Ulciscor

  • Bot Destroyer
  • ***
  • Posts: 401
    • View Profile
    • http://spaces.msn.com/members/shadowedjustice
Survival-of-the-fittest evobot
« Reply #2 on: February 14, 2006, 07:13:16 PM »
Isn't this kind of going on the assumption that any of the offspring will get to the repro threshold?
:D Ulciscor :D

I used to be indecisive, but now I'm not so sure.

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
    • http://community.webshots.com/user/objack2
Survival-of-the-fittest evobot
« Reply #3 on: February 14, 2006, 07:17:00 PM »
found my bots gaining energy and reproducing in the normal
manner long before they reached their 'breeding age' which
then dropped them below the energy requirement and they
continued to roam about and gain seek more food.
so I commented out the energy requirement and made
repro dependant upon age only.

' Activate repro mode!
cond
'*.nrg 20000 >
*.robage 1000 >
start
1 .fixpos store
stop

also did a  *.robage 750 > and a *.robage 1250 >
[changed the 'unfix gene' as well]
called them SBD750 [StoreBreedDie], SBD1000, SBD1250
and run them off against each other.
interesting ... the 750 repros ahead of the others and more
often but of course produces fewer offspring before dying,
the 1250 taking a long time but with 60 or 70 offspring ...
and the 1000 inbetween.
did it with mutations disabled to watch the 'pure' form to see
which seems most hardy ...
but figure mutations might yeild some interesting hybreds.

fun to watch. ;)
« Last Edit: February 14, 2006, 07:17:25 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 Ulciscor

  • Bot Destroyer
  • ***
  • Posts: 401
    • View Profile
    • http://spaces.msn.com/members/shadowedjustice
Survival-of-the-fittest evobot
« Reply #4 on: February 14, 2006, 07:25:39 PM »
[Griz] - doesn't making repro dependant on age mean that the bots may be born with v low energy? This seems a little unfair... although I guess bots born to a parent with high energy have a greater chance of survival than those with lower.
:D Ulciscor :D

I used to be indecisive, but now I'm not so sure.

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
    • http://community.webshots.com/user/objack2
Survival-of-the-fittest evobot
« Reply #5 on: February 14, 2006, 08:02:49 PM »
Quote
[Griz] - doesn't making repro dependant on age mean that the bots may be born with v low energy? This seems a little unfair... although I guess bots born to a parent with high energy have a greater chance of survival than those with lower.
 
they may ...
as elite says ... survival of the fittest.
'tis an experiment after all ...
why bot let the bots determine what works or what doesn't?
if they can't hack it ... kiss 'em goodbye. ;)
anyway, these aren't regular bots ...
but elite's idea of having a punctuated reproduction.
those that survive their #of cycles get to reproduce
however many offspring they can support.

it's interesting to watch the spurts ...
a bot set to 500 cycles reproducing twice as often ...
but with half the offspring [or less anyway] than the
bot using a period of 1000.

so far, the longer period bots are winning out ...
but I imagine this might vary depending on which
others they have to compete against.
will see what mutations bring on.

it's interesting to watch ...
as one gets one reproducing at 500 cycles into the sim ...
as well as at 1000 along with a 2nd bot ....
and again at 1500 with both the 2nd and 3rd as well ...
so there are large spurts and all of that is dependant
upon the veggie population as well.

just experimenting.
run it and see for yourself

btw ... in version 2.37.6 ... I still have a lot of problem with
the population control ... NOT controlling.
the max limit seems to be ignored most of the time ...
my bot population usually ending up nearly double what I set ...
actually, as if it adds the max number and the repro level setting.
yet .. at other times, it seems to work.
iwo, I don't have much to say about it.
不知
~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 #6 on: February 14, 2006, 10:44:37 PM »
I tried something similar(*.robage 400 >) and they eventually evolved a method to survive better. They started using *.pleas instead of 50 as their Repro percentage. Neat little trick. B)

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7716
    • View Profile
Survival-of-the-fittest evobot
« Reply #7 on: February 15, 2006, 12:48:17 AM »
Quote
btw ... in version 2.37.6 ... I still have a lot of problem with
the population control ... NOT controlling.
the max limit seems to be ignored most of the time ...
my bot population usually ending up nearly double what I set ...
actually, as if it adds the max number and the repro level setting.
yet .. at other times, it seems to work.
iwo, I don't have much to say about it.
This is actually fairly normal.  More than double what you set means we have a real issue.  Limiting population fairly isn't as easy as you might think.

I know that's not really an excuse (well, I guess it sort of is actually), I'm just not sure exactly how to fix it without causing some odd biases.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2554
    • View Profile
    • http://kuro-tejina.com
Survival-of-the-fittest evobot
« Reply #8 on: February 15, 2006, 08:49:13 AM »
The reason for this is the way in which the robots actually reproduce.

When the program comes across a repro command, it doesn't simply make that bot reproduce immediately as it would with .up or .shoot.
What happens is that a "pending" list of bots that are ready to repro is created. This list is then acted on in a completely seperate part of the program in a single loop that has no easy and fair way to prevent more births.

Basically we can disable reproduction of veggies quite easily when the veggie population exceeds a certain value. Trouble is that the program counts the actual veggie population at the beginning of each cycle to save on processor time. This means that either NONE of the veggies are allowed to reproduce on a given cycle or ALL of them can. It's really the only fair way or else reproduction enablement would be a function of arbitrary robot numbers (first born gets to breed while later ones don't). That would really suck for evolving veggies.

Just think of the maximum population as being the maximum threshold at which veggies are allowed to reproduce. If they all choose to do it on the same cycle then you can potentially get double the limit in actual population.

As Num said, If you get more than double then something is very wrong. Otherwise there ain't much we can do about it.
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
    • http://community.webshots.com/user/objack2
Survival-of-the-fittest evobot
« Reply #9 on: February 15, 2006, 10:10:36 AM »
Quote
As Num said, If you get more than double then something is very wrong. Otherwise there ain't much we can do about it.

ah ....
ok, that makes sense.
no, I don't think it ever goes above 2x.

good to know it isn't just me. ;)

what settings then would you recommend for
max # of veggies:
threshold for repro:
number of veggies per repro event:
and the cooldown period:

if, for example, I wanted to maintain a pop around 100?
I'm looking to keep the population as steady as possiby
in some sims.
sometimes using 100, 99, 1, 1 for the above works fine.
at other times, it results in close to double that ...
so I go for 50,48,1,1 or something.

that's what throws me off ...
I don't seem to be able to have it work consistantly ...
I'm just looking for ways to have it be close to
what I would like to see. ;)

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 Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
    • http://community.webshots.com/user/objack2
Survival-of-the-fittest evobot
« Reply #10 on: February 15, 2006, 10:12:00 AM »
Quote
I tried something similar(*.robage 400 >) and they eventually evolved a method to survive better. They started using *.pleas instead of 50 as their Repro percentage. Neat little trick. B)
yeah.
will keep playing with them.
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
    • http://community.webshots.com/user/objack2
Survival-of-the-fittest evobot
« Reply #11 on: February 15, 2006, 10:19:53 AM »
Quote
I tried something similar(*.robage 400 >) and they eventually evolved a method to survive better. They started using *.pleas instead of 50 as their Repro percentage. Neat little trick. B)
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?

I am most of all interested in 'evolved' bots so ...
just looking for hints about how to best go about finding them.

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 Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Survival-of-the-fittest evobot
« Reply #12 on: February 15, 2006, 11:20:38 AM »
Wow, so many replies  :rolleyes:

Heres the latest version:

Code: [Select]
cond
start
.tie *.robage 1 add mult inc
.deltie inc
stop

cond
*.robage 1 =
start
628 .aimdx store
stop

cond
*.fixed 0 =
*.eye5 0 !=
start
-6 .shoot store
stop

cond
*.eye5 0 !=
start
40 .up store
stop

cond
*.eye5 0 =
start
314 rnd .aimdx store
stop

cond
*.robage 1000 >
*.body 500 >
start
1 .fixpos store
stop

cond
*.fixed 0 !=
start
314 rnd .aimdx store
100 *.nrg 500 div div 50 ceil .repro 1 rnd add store
stop

cond
*.fixed 0 !=
*.robage 1000 <
start
.fixpos dec
stop

end

Weaker bots are quickly killed by their more efficient siblings, weeding out 'bad mutations' much more effectively.
This version also randomly hyper-mutates half of its offspring for an increased flow of mutations into the sim. Most die but some do well.

This bot seems to produce lots of 'big bertha' type robots though.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2554
    • View Profile
    • http://kuro-tejina.com
Survival-of-the-fittest evobot
« Reply #13 on: February 15, 2006, 11:28:58 AM »
Quote
what settings then would you recommend for
max # of veggies:
threshold for repro:
number of veggies per repro event:
and the cooldown period:

Try a nice in-between value of about 75 for max pop if you want a mean value of 100.

I never really mess with the others all that much. Cooldown period is largely irrelevent unless you have an exceptionally high veggie feed rate. It's going to take them a finite number of cycles to regain half of their energy anyway.

The biggest problem (IMO) is that all the veggies begin the sim at the same energy level, then they are fed at the same rate so they all want to reproduce on the same cycle. maybe we should randomize the feed amount within certain perameters.
For example, if you set feed rate per cycle to 10 then they will actually get a range from 8 to 12 instead of exactly 10.
You can also do this in the veggie DNA code by replacing the standard repro value with a custom variable that is randomly defined at birth

Try this little veggie out. It is a version of Alga minimalis fitted with a randomized reproduction level.
There are 10 kinds of people in the world

Those who understand binary.

and those who don't

:D PY :D

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Survival-of-the-fittest evobot
« Reply #14 on: February 15, 2006, 11:43:14 AM »
Here's another evobot I'm experimenting with. Good results so far.

Code: [Select]
cond
*.eye5 0 !=
start
-1 .shoot store
stop

cond
*.eye5 0 !=
start
20 .up store
*.eye6 *.eye4 sub .aimdx store
stop

cond
*.eye5 0 =
start
314 rnd .aimdx store
stop

cond
*.nrg 10000 >
start
10 .repro store
stop

cond
*.numties 0 >
start
32000 .tielen1 store
stop

end

Nice Alga, looks more natural  :)