Bots and Simulations > Bot Tavern

Rogue genes

(1/3) > >>

Bluchrome:
I took a long break from darwinbots. Just reintroduced myself yesterday and I started a little bot to get re-familiarized with DNA programming. For the most part everything is working OK. Except there's a gene activating when it shouldn't. Here is the gene along with the other relevant ones:

Some defines
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']
def specIDloc     972
def specID        310
def sthreshold    20  'Distance at which the effects of the tracking gene gets deactivated and the feeding gene activates


(These aren't contiguous)
This sets the species' ID
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']
'Set spec
cond
*.robage 0 =
start
.specID .specIDloc dup .memloc store store
stop


The problem gene is in this section
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']
'Scan eyes
cond
*.eyef 0 =
*.memval *.specIDloc = or
start
.up 10 *.velscalar sub sgn 0 floor mult dup inc inc
*.timer 9 mod 4 sub .focuseye store
stop

'Center eye5 on prey
cond
*.eyef 0 !=
*.memval *.specIDloc !=
*.focuseye 0 !=
start
*.focuseye 140 mult .aimdx *.robage sgn mult store
0 .focuseye store
stop

'Track prey
cond
*.eye5 0 >
*.memval *.specIDloc !=
0 *.focuseye =
start
*.refvelup 50 add .up .sthreshold *.eye5 sub sgn 0 floor mult store
*.refxpos *.refypos angle .setaim *.robage sgn mult store
stop

The problem is the track prey gene gets activated even when eye5 'sees' the same species (despite the *.memval *.specIDloc != condition), and starts to chase it.
The only thing preventing it from continuously tracking it's own species is that the scan eyes gene is still activated and changes the focuseye the next cycle. So it results in intermittent tracking (of its own species) every 9 cycles. This bot works fine for non-specs and even though it doesn't shoot it's own species (the feed gene doesn't activate for conspecs), it is a wasteful behaviour and I really can't see why this gene is activating. I've used to console to evaluate the conditions and in the cycle that the track gene gets activated it shows that *.memval = 310 and *.specIDloc = 310. Also is *.timer capped at 32000 like *.robage?

BTW: The eyes' position and width have been changed to provide even 360 deg. vision

Moonfisher:
Well timer isn't capped, it'll start over, although I'm not sure where it starts and which way it counts. (If you're using mod it won't matter)
As for the other issue I can't see anything wrong anywhere, so can't help ya.

Bluchrome:
Thanks for trying. It's really frustrating but I'll fiddle with it until it works (hopefully).

abyaly:
You need to check if the value of the memory location was what you expected it to be at the time of activation, but if you use the console to just check *.memval and *.specIDloc you may get fresher values than what the gene saw.

Stick something like this in front of the gene in question:


--- Code: ---cond
start
*.memval .test1 store
*.specIDloc .test2 store
stop
--- End code ---

Bluchrome:
I thought those sysvars where populated before the DNA even began executing. Its a surety that *.memval is equal to *.specIDloc or the scan eyes gene would not activate in that cycle. This is truly puzzling, I wonder if it has anything to do with instabilities in the beta version (or some detail I'm overlooking). In any case, if I can't find a cause/solution I'll just rewrite the conspec system

Navigation

[0] Message Index

[#] Next page

Go to full version