'An explained bot, like a manual inside a bot, by peterB as a starter bot to learn from.
'The bot in the end became a bit more advanced then I had planned.
'Its a result of playing with all the inner valleus
'I still dont understand it all, but this bot allready defeats lots of other bots, like C-Filanse and I-flamma.
'Its not that smart I thnk but reproduces with not that much energy
'As a canibal its stable alone for quite a while, but as a group of pirhana's its also a feeder.
'Tough in such a group it not realy kills it's prey fast so as a group it has food storage...
'In a group environment it has time to create ofspring, as sexual reproduction from a group.
'
'
' As this was my first bot I took lots of readable notes in it.
' In a way this bot is a manual too, I tried to explain it myself
' And maybe to others.
' So I kept the explaining language close to the topic of programing these bots.
'
' And is therefore verry easy to adjust, or to understand
'
'
'SENSORS and variables
'============================================================================
=============
' A basic sensor is an eye
' There are multiple eyes but lets focus at the most important one, the forward looking eye5
' To get info from an eyse5 you need to read it out, this is done by the command:
' *.eye5
' Its reads from the fronteye (number 5 is front)
' Its the same as reading from memory location *505 (dough thats harder to understand).
' Its value 'll be greater then 0 if it sees something
' The more nearby the higher the valeu (max is 100 I asume)
' There are more type of sensors.
' for age etc etc, you'll see them later.
'
' Moving a simple
'============================================================================
=============
' *.up my own up speed.
' note to add 30 up to my own speed use: *.up 30 add .up store
'
' *.dx my rotation value
'
' Often remote sensed bots start with ref, and local sensors with my like:
'
' *.refeye *.myeye (counts number of eyes often used for species comparison)
' *.refvelup (relative bots speed from your eyevector)
'
'
'
'CONDITONAL COMPARISON
'============================================================================
==============
' = equals
' %= almost equal, whitin 10%
' != notequal
' > greather then
' < smaller then
'
'
'
' What in basic languaga would be:
' IF EYE = 10 THEN..
' ...
' END IF
'
'
' Is in darwin bots genetics
' cond
' *eye5 10 = (note type of comaprison comes last).
'
'
' Other type of sensors
' *.refeye *.myeye != ( count other bots number of eyes, and compare it to my number of eyes) if not equal..
' ( this is often used to detect friend or foe, by counting eyes.
' ( dough what if the enemy has the same amount of eyes
'
' MOVEMENT
'============================================================================
=================
' *.refveldx .dx store (move at otherbots, sideway motion speed )
' *.refvelup 30 add .up store (compared to my bot's eyte direction the other bots speed + 30)
'
'
' So lets move forward with our manual and our first little cel.
' And lets us do something when there is nothing big nearby..
' the valeu of an eye seams to get higher when its more nearby
' so 100 is when your eye bumps into something and 10 is something far away.
' Wel I dont want to go to fast if something gets nearby.
' Like using my carbrakes for a piza nearby.
' so I check for a cond (condition) in which the eye hasnt anithing nearby as close as 40
' Then I start what I want to do in this condition
' That is go forward 8 by storing 8 in the upwards engine
' Thats the end of comands for this gene so this gene comands ends with a stop
' GENE 1
cond
*.eye5 40 <
start
8 .up store
stop
'GENE 2
' Gene 2 Food Finder and eater
' is food nearby?
' But altough its a killer cell it wouldnt eat young childs younger then 300 cycli
' A remote cells age can be questioned with *.refage
' Such child could be our own children, or my enemy or even young plankton.
' But well plankton childs or enemy childs will not be eaten.
' Dough older cells I will eat them. So I shoot them, here simple shooting = eating.
' this is done by storing a negative value -1 in .shoot memory
'
' The next 2 lines align us better with our target for a possible next shoot.
' refveldx (targets orientation, store it in local orientation
' And now for our engine store there a relative speed 10 higher as our targets speed
cond
*.eye5 40 >
*.refage 300 >
start
-1 .shoot store
*.refveldx .dx store
*.refvelup 10 add .up store
stop
'GENE 3
' If I remember one thing of bioligy lessons in fact my only lesson
' That it had all to do with reproction, DarwinBots can reproduce too
' The question is when should we do this, and how does it work.
' Wel most cell in darwinbots devide asexual, only based on their energy reserve
' Energie level can be retrieved trough sensor *.nrg
' most of the times I saw *.nrg 5000 >
' but I will use a lower value 2500 in this one just for fun...(life is like go and multiply)
' Also the question is how much energy would you like to give to your child mostly I see
' 50 .repro store
' will result in a child with 50% of the energy stored it is commonly used.
' But just for the fun of it, the parents will only give 30% (childs are weaker then parents)
' After givin birth the parent runs fast away, yup that can happen in nature.
cond
*.nrg 1500 >
start
30 .repro store
'10 .up store
100 .dn store
stop
'GENE 4
' if it doesnt see anything every hunderst cycle then turn
' This helps us getting away from walls or empty spaces, its called random walks.
' then perform a command .aimdx (clockwise turn)
' oh btw.. for the other counter-direction use aimsx
' A total turn in DarwinBots = 1256 units
' so 1256 = 360 degrees or 2pi
' 628 = 180 pi
' 314 = 90 pi/2
' lets add a random valeu of such degrees to the current direction.
cond
*.eye5 0 =
*.robage 100 mod 0 =
start
628 rnd *.aimdx add .aimdx store
stop
'GENE 5
' This gene realy is programing evolution at work..
' What I tried to do first was remove a child's birth tye, if also he had clear runaway path.
' Dough I didnt clearly understood how that worked.
' For some reason a tie kept alive
' So I started up mixing code from the website, and then it turned into something else
' I left this killer bot keep his tye's, till it has more then 1500 energy (adulthood)
' Now my first tought was to run away forward
' Hmm.. but if runned backward and not to fast
' Then it would probaply gonna eat from something it had catched before.
' I still regulary see some of them break free, like a spore thats nice.
' Dough since also a single bot could could activate this gene but should not runaway from its food..
' so lets dont walk that fast backwards just say 5 or so.
cond
' *.robage 1
*.eye5 60 <
*.nrg 1000 >
start
.tie inc
'*.tiepres .deltie store
5 .dn store
stop
'GENE 6
' I actualy found from the website
' it eats the others bot energy (plankton here we go...)
' but also dumps waste in the other bot.
' it took 99 % of energy, but hey lets be a little bit fair here and take 16%
' that sounds small, but keep in mind we dont break the tye..
'
' note when not using any conditionar and changing this valeu to 5 10 15 25 etc
' gives nice side efects in ofspring creatures
' soms might be able to live together with 1 plankton.
' Its questioning of balancing this valeu.
'
' However in the end I took a different aprouch I wont eat others energy all the time.
' So there will be differences in a group (to let others be able to get energy offspring).
' This is also balanced a cingle plankton and a single canibal will also grow slowly.
cond
*.robage 20 mod 0 =
start
50 .sharenrg *.multi mult store
.sharewaste *.multi mult inc
stop
end
' So that was the whole genome, it ends with the word end,
' But wait there is much more then this writing above here.
' A lot of other function vars and commands can be found here at this site:
'
http://www.darwinbots.com/WikiManual/index.php?title=Sysvars