def maxpop 1000
def alge 13

def rand 110
def type 973

cond
*.nrg 15 >
*.numties 0 != or
start
.fixpos dec

'-- Birth
*.robage 0 =
314 .aimright store
.deltie inc
300 .eye5width store
.dnalen .memloc store
.dnalen .tmemloc store
15 rnd .rand store

*.rand 5 < and
*.rand .type store

*.type 0 =
5 rnd .type store


'-- Reproduction
*.body 5 >
*.nrg 80 > and
*.totalmyspecies .maxpop 2 mult < and
*.maxvel .dn store
50 .repro store

*.totalmyspecies .maxpop <
*.nrg 200 > and
50 *.body 10 mult sub 0 floor .strbody store

'-- Tie feeding
cond
 *.eye5 0 >
 *.refeye *.myeye !=
start

 *.refveldx .dx store
 *.refvelup 30 add .up store
 Gene 2 Eat Food
cond
 *.eye5 50 >
 *.refeye *.myeye !=
start
-1 .shoot store
 *.refvelup .up store
stop

*.numties 0 !=
*.tiepres .tienum store

*.tmemval *.dnalen =
*.numties 1 > or and
*.numties .deltie store

*.numties 0 !=
*.robage 1 > and
*.trefxpos *.trefypos angle .setaim store
99 .sharenrg store