Author Topic: Bots evolve to take advantage of a loophole in 2.4X  (Read 2519 times)

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Bots evolve to take advantage of a loophole in 2.4X
« on: April 14, 2006, 04:27:41 PM »
So the mainline routine that does all the bot execution, everything from doing all the tie and shot calculations to figuring out movement and costs and reproduction looks like this:

UpdateBots()
Do a bunch of stuff for all bots, including applying costs
Check for nrg <0 (and other things) and set it to 0 if it is
Do a bunch of other stuff for all bots including feeding from body
Kill bots with 0 or negative nrg
End

The bots in my South Pacific Sim have evolved a way to exploit a loophole inherent in this architecture.  Basically, in this sim, selection favors bots that can survive long enough to make it from one "island" to another.  There's no energy supply between islands and I have a per cycle cost of 10 nrg/cycle, so there is a pretty severe cost per cycle even when not doing anything.  So, selection would favor you if you could find a way to get by the per cycle cost.  Well, my bots have evolved to do this by storing energy away in body when near an island and then running with enegy very very low, like 1 between islands.  They let the cost calculations take their energy negative in the first part of the routine, get set back up to 0 in the middle, then feed from their body in tiny little bites, enough so their energy is back up above 0 by the time the decesion to kill off bots is made.  This lets them bypass most of the costs - all they are using is the tiny bit of body to take their energy from 0 up to 1 per cycle instead of paying the full cycle cost each time.

Pretty damn clever and just another example that evolution can surprise you in the solutions it finds!

I've addressed this in 2.42.3 so that negatvie energy is preserved all the way through the UpdateBots() routine so that there is no way to cheat.  If you don;t feed enough from body to get your energy back up above 0, you will get killed off.  I need to do some long term runs to make sure this doesn't open the door for some overflow/underflow bugs, but so far, so good.
Many beers....

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Bots evolve to take advantage of a loophole in 2.4X
« Reply #1 on: April 14, 2006, 04:31:13 PM »
Now that's pretty cool.  Those little buggers

I hate order of operations code.  It's a real pain.

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Bots evolve to take advantage of a loophole in 2.4X
« Reply #2 on: April 15, 2006, 03:34:22 AM »
The program is self de-bugging  

Seems like there's always another free-nrg bug out there. At one point bots could eat their own low nrg children and gain more nrg than they lost.

Gotta hand it to evolution though, life is always trying to find a way to survive.