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