*sigh*
Ok in darwinbots every organism has 9 eyes, each eye's input value is equal to the apparent distance from the eye, because you probably want more information than distance you also have to specify the value of .focuseye which should be anywhere between -4 and 4 each value referring to an eye .eye1 is the furthest on the left, .eye5 is in the middle and .eye9 is on the right, so in simple English it says:
Compare the value of .eye1 to
every other eye, if the value of .eye1 is the greatest remember the number -4
Compare the value of .eye9 to
every other eye, if the value of .eye9 is the greatest remember the number 4
Compare the value of .eye2 to
every other eye, if the value of .eye2 is the greatest remember the number -3
Compare the value of .eye8 to
every other eye, if the value of .eye8 is the greatest remember the number 3
Compare the value of .eye3 to
every other eye, if the value of .eye3 is the greatest remember the number -2
Compare the value of .eye7 to
every other eye, if the value of .eye7 is the greatest remember the number 2
Compare the value of .eye4 to
every other eye, if the value of .eye4 is the greatest remember the number -1
Compare the value of .eye6 to
every other eye, if the value of .eye6 is the greatest remember the number 1
Compare this number to .focuseye depending on the difference add 1 or subtract 1 repeatedly until the value of .focuseye is equal to the value you have remembered.
The reason it's so complex is
a) Rather than using normal conditions it instead uses unconditional logic rather than normal operands
Rather than
">" I'll type
"sub sgn 0 floor mult" which translates too subtract the previous two values from each other then take the sign of that value (-1, 0 or 1) then make 0 the lowest number possible and then I'll be left with the number I wanted to remember and I'll either multiply it by 1 or 0
b) Remembering without storing into your memory is HARD
If you remember I was comparing numbers at the start so 8 eyes each compared to 7 eyes? That makes 56 times I have to run through 6 different numbers only 1 of them is the number I want and because of the way I did it every other number is equal to 0 and I can add all these numbers together eliminating the 0s (only the top number in the memory stack is looked at).
c) I don't just type .focuseye store
Now at this point most people would just type .focuseye store which stores the value you rememberd however that uses up a bunch of energy instead I created gates similar to the logic stuff where it does the whole adding and subtracting thing by 1 as doing this uses up ten times as less energy as a store, it also doesn't change the value every time - only if the value needs to change which is one of the things that makes it effcient
So now do I get a medal?
Oh yeah and here's a much simpler bot so as not to melt out your brains:
'Animal_Minimalis
'By: Nums
'Good for mutation sims and for
'noobs to see how a basic bot works.
'Contains everything necessary for it
'to survive and reproduce.
' Gene 1 Food Finder
cond
*.eye5 0 >
*.refeye *.myeye !=
start
*.refveldx .dx store
*.refvelup 30 add .up store
stop
' Gene 2 Eat Food
cond
*.eye5 50 >
*.refeye *.myeye !=
start
-1 .shoot store
*.refvelup .up store
stop
' Gene 3 Avoiding Family
cond
*.eye5 0 =
*.refeye *.myeye = or
start
314 rnd .aimdx store
stop
' Gene 4 Reproduce
cond
*.nrg 20000 >
start
10 .repro store
stop
end