Author Topic: food finding and eating genes  (Read 3336 times)

Offline peterb

  • Bot Destroyer
  • ***
  • Posts: 148
    • View Profile
food finding and eating genes
« on: March 30, 2010, 05:13:58 PM »
I'm trying to figure out good food eating and aiming genes

I've made below, besides that i wonder if the code is good (can i use multiple times .up ?)

What i would look is that it would move to 3/4  or maybe 1/2 of the distance between its target.
So no matter the speed or its own body mass (it requires some adjustments).
The shooting is allready quite good, and it less often does circle around algeas
And even while pretty big it speeds up a lot to for example to meetup with Efilans or others  (but will soon be outnumbred no repro so far)

The only problem is it can stay behind a enemy without ever coming closer if they move  (algea work fine)

here is the code so far.


Code: [Select]

'Polinator
'requires 2 types

def reproval 50    '10...100
def bigsmall 51    '10...100
def direction 52
def etarget 53
def eyetemp 54
def shootnow 55
def shootdist 56

'=================================================================
'GENE FOR FINDING FOOD
cond
*.eye5 0 =
start

'eye9 or eye1 are (each eye = 35 units, *4 = 130
'
' if we see something get fixed and turn into its direction.
' next the GENE FOR EATING  will run for it
'

*.eye9 *.eye1 sub sgn .eyetemp store
*.eyetemp 130 mult .aimdx store

0 .fixpos store
'  nothing insight +10 up
*.eyetemp abs -1 add abs 5 mult .up store
*.eyetemp abs -1 add *.mass mult .dn store
*.shootdist *.mass mult *.refvalscalar add .up store

stop


'====================================================================
'GENE FOR EATING   'using advanced shooting mechanism
cond
 *.eye5 0 >
' *.in1 *.reproval !%=
' *.in2 *.bigsmall !%=
'*.refeye *.myeye !=
start

*.refxpos *.refypos dist .shootdist store

' .shootnow   this mimics *.eye5 > 40  and gets a valeu of (0|1)
*.eye5 40 sub sgn 1 add sgn .shootnow store

*.refxpos *.refypos angle .etarget  store
1256 *.aim sub *.etarget add .etarget store
1256 *.etarget sub .etarget store
*.etarget .aimshoot store

*.etarget .aimdx store


*.shootnow .fixpos store
*.shootnow -1 mult .shoot store
'0 .fixpos store
*.shootnow 1 sub abs .shootdist mult 2 div 1 rnd add .up store

stop

end
« Last Edit: August 28, 2010, 04:42:34 PM by Shasta »