Author Topic: Well. I need a tad bit O' help with this dna  (Read 508 times)

Offline spike43884

  • Bot Overlord
  • ****
  • Posts: 656
    • View Profile
    • OurIllogicalWorld Blog
Well. I need a tad bit O' help with this dna
« on: February 24, 2015, 01:16:22 PM »
I created a bot based off the caterpillar MB structure, a chain...its amazing in every way realistically, just a mere chain...So I created 'slither'. Version 1 was a failure, but then it was very undeveloped code. V1.5 (Slither length) was relatively successful, except it dies to quickly, it does sustain medium population, but dies very rapidly as individuals. Slither V2 is meant to have a gene like 'all hunter' where if nothing is seen, then the head will move rapidly randomly around the area, and the body because of a 'body follow' gene will just follow behind, the body can't move .up or .dn but can shoot, I'd like to include a function to let it turn to face prey...if possible. So I'll submit in this post slither V2 so you can understand the code and fix it hopefully. Its a slight frankenstein of DNA, as the hunting, eyes, and body and movement management come from other things...though the code for them has been changed to make it flow smoother.
Code: [Select]
'Slither 2
'By Spike
'Because caterpillar takes to much of the glory.

def minlen 50
def maxlen 51
def head 52
def hunt 53
def sight 54


'Initilisation (TIELENX)
start
500 .maxlen *.maxlen 500 sub sgn 1 add mult store
stop

cond
*.tielenx *.maxlen >
start
*.tinlenx 10 add *.tielenx store
stop

or

def minlen 50
def maxlen 500

cond
*.tielenx .maxlen >
start
*.tielenx 10 sub .tielenx store
stop


'Initialisation (EYES)
cond
*.robage 2 <
start
135 .eye1width store
135 .eye2width store
135 .eye3width store
140 .eye4width store
4 .eye5width store
140 .eye6width store
135 .eye7width store
135 .eye8width store
135 .eye9width store
410 .eye1dir store
300 .eye2dir store
190 .eye3dir store
75 .eye4dir store
0 .eye5dir store
-75 .eye6dir store
-190 .eye7dir store
-300 .eye8dir store
-410 .eye9dir store
stop


'Gene 1 No food = Hunt
cond
*.sight 0 =
*.head 1 =
*.hunt 0 =
start
157 rnd .aimdx store
1 .hunt store
stop


'Gene 2 No food & Turned = Move
cond
*.sight 0 =
*.head 1 =
*.hunt 1 =
start
15 .up store
2 .hunt store
stop

cond
*.sight 0 =
*.head 1 =
*.hunt w =
start
10 .up store
3 .hunt store
stop

cond
*.sight 0 =
*.head 1 =
*.hunt 3 =
start
10 .up store
0 .hunt store
stop


' Gene 1 Food Finder (waiting)
cond
*.eye1 sgn
*.eye2 sgn add
*.eye3 sgn add
*.eye4 sgn add
*.eye5 sgn add
*.eye6 sgn add
*.eye7 sgn add
*.eye8 sgn add
*.eye9 sgn add 0 =
*.refeye *.myeye = or
*.head 1 =
start
10 rnd .aimdx store
stop


'Gene 1 Find Food
cond
*.eye5 0 >
*.refeye *.myeye !=
*.head 1 =
start
*.refveldx .dx store
*.refvelup 30 add .up store
1 .sight store
stop


'Gene 2 Eat Food
cond
*.eye5 50 >
*.refeye *.myeye !=
*.head 1 =
start
-1 .shoot store
-6 .shoot store
*.refvelup .up store
1 .sight store
stop


'Gene 3 Eat Food As the Body
cond
*.eye5 50 >
*.refeye *.myeye !=
*.head 0 =
start
-1 .shoot store
-6 .shoot store
stop


'Gene 4 Reproduce
cond
*.nrg 20000 >
*.head 0 =
start
10 .repro store
stop


'Gene 5 Head Allocation
cond
*.numties 0 =
*.head 0 =
*.robage 0 !=
start
1 .head store
stop


'Gene 6 First Birth
cond
*.head 1 =
*.numties 0 =
start
25 .repro store
stop


'Gene 7 Body/NRG Control
cond
start
*.body *.nrg 2 mult sub 0 floor .fdbody store
*.nrg 2 mult *.body sub 0 floor .strbody store
stop


'Gene 8 If MB Stuff
cond
 *.multi 1 = or
 *.hibernate 0 =
start
 50 .sharenrg store
 500 .maxlen store
 60 .stifftie store
stop

'Gene 9 MB communication
cond
 *.eye5 0 !=
 *.head 1 =
start
 *.eye5 .tout1 store
 *.aimdx .tout2 store
stop


'Gene 10 MB communication (for body)
cond
 *.tin1 0 !=
 *.head 0 =
start
*.tin2 .aimdx store
stop


'Gene 11 Connect
cond
*.robage 0 =
start
.tie inc
620 .aimdx store
stop


end
Autism can allow so much joy, and at the same time sadness to be seen. Our world is weird, and full of contradiction everywhere, yet somehow at moments seems to come together, and make near perfect sense.