Darwinbots Forum

General => Leagues => Bot Challenges => Topic started by: PhiNotPi on April 28, 2011, 06:12:02 PM

Title: Shortest Fully Functional Bot
Post by: PhiNotPi on April 28, 2011, 06:12:02 PM
How short can a bot be and still be fully functional?  This is a competition to find out.  To be considered "fully functional" the bot must meet these qualifications:
There are various awards for this competition. These are as follows:

PLATINUM- Shortest entry out of all of the entries that meets the above qualifications.
GOLD- DNA length under 25.
SILVER- DNA length under 35.
BRONZE- DNA length under 45.
COPPER- DNA length under 60.
QUALIFIER- Bot meets above qualifications.

It may seem like I set the bar high for the awards, but some are easier than you may think.
Title: Re: Shortest Fully Functional Bot
Post by: Panda on April 29, 2011, 06:44:22 AM
I don't know if you will be able to count this... but, I think it does everything. :)

Code: [Select]
start
5 .up store                             'always move up, makes it easy to follow other bots
*.eye5 0 != *.refeye *.myeye != and
*.refveldx .dx store
-1 .shoot store                         'shoot and keep dx the same speed as any bot which does not have the same number of eyes as me.
*.nrg 5000 >
20 .repro store                         'reproduce when energy is larger than 5000
                                        'EDIT:it's a little cheeky of me, but no stop shortens it by one. HEHEHEHE

EDIT:It's 25 24 long, according to the DB2, but 24 23 long if you count it...
Title: Re: Shortest Fully Functional Bot
Post by: Numsgil on April 29, 2011, 05:05:35 PM
Exact same bot, even shorter:

Code: [Select]
start
.up inc                              'always move up, makes it easy to follow other bots
*.eye5 0 != *.refeye *.myeye != and
*.refveldx .dx store
.shoot dec                        'shoot and keep dx the same speed as any bot which does not have the same number of eyes as me.
*.nrg 5000 >
20 .repro store                         'reproduce when energy is larger than 5000
                                        'EDIT:it's a little cheeky of me, but no stop shortens it by one. HEHEHEHE

And even cheekier (though not tested; the behavior is a bit different)

Code: [Select]
start
.up inc
*.nrg 5000 > .repro inc
*.eye5 *. 0 != *.refeye *.myeye != and
*.refveldx .dx store
.shoot dec

I count 20 instructions...  I can't get lower than that.
Title: Re: Shortest Fully Functional Bot
Post by: Panda on April 29, 2011, 05:19:10 PM
I didn't think of inc/dec!

EDIT: Some of the behavior didn't seem to work on the one that you put on Nums... :s I did some jigging around and got it to work. They were horribly slow and sometimes shoot themselves to death when the bot they were shooting at was too far away, so I changed it so it is "eye5 30 >" They don't kill themselves anymore! And they definitely survive now!

Code: [Select]
start
.up inc
*.eye5 0 != *.refeye *.myeye != and
*.refveldx .dx store
.shoot dec
*.nrg 5000 > .repro inc
Title: Re: Shortest Fully Functional Bot
Post by: Numsgil on April 29, 2011, 06:50:39 PM
Haha, thanks.  I can write bots but I can't test them at work :P
Title: Re: Shortest Fully Functional Bot
Post by: Panda on April 30, 2011, 07:23:07 AM
I have no idea what caused it! It looked perfectly fine! Just mixing it up made it work... :)
Title: Re: Shortest Fully Functional Bot
Post by: PhiNotPi on May 01, 2011, 07:09:41 PM
I have successfully created a bot with a DNA length of 19.  I seem to be entering into my own competition, but I am going to post the bot anyway.
Code: [Select]
start
*.refvelup 1 add .up store
*.refveldx .dx store
*.refeye *.myeye !=
.shoot dec
*.nrg 5000 >
.repro inc
I used a few tricks to make this bot shorter.  It copies the upwards velocity, and adds one. Even when it does not see anything, it will still add one.  This is its active hunting and part of pursuing. The sideways motion is also copied from any bot.  The resultant swarming behavior seems to help the bot, because they are more likely to be closer to food before they spot it.  The bot shoots at  food, regardless of distance.

I am beginning to wonder if it is possible to create a shorter bot. The last five commands (the reproduction) may be impossible to shorten.  Conpec recognition adds 3 at minimum( *.refeye *.myeye != ).  Start adds 1. Shooting adds 2. The motion of searching adds 2. This means that fully functional bots must have at least 13 commands in their DNA.

Also, even though I only count 19, DB says that the DNA length is 20.  I think this is due to the lack of a stop, which DB may count but isn't there.
Title: Re: Shortest Fully Functional Bot
Post by: Numsgil on May 01, 2011, 08:27:34 PM
I think it adds one implicit "end" basepair.

I thought about getting rid of the *.eye5 0 > check, but it's hard to get the bot to behave when it's chasing ghosts.
Title: Re: Shortest Fully Functional Bot
Post by: Panda on May 01, 2011, 09:20:33 PM
If only we can get the conspec shorter...
Title: Re: Shortest Fully Functional Bot
Post by: PhiNotPi on May 02, 2011, 06:46:36 AM
The conpec and shooting lines:
Code: [Select]
*.refeye *.myeye !=
.shoot dec
Can be shortened if we knew the enemy's *.myeye. If we knew that the enemy always had 1 eye, we shorten these lines to
Code: [Select]
.shoot *.refeye mult inc
(Even cooler) If we knew that the enemy always had 7 eyes, then we can chnge this to
Code: [Select]
*.refeye dec
Both of these take advantage of the fact that this bot has a myeye of 0.  The second one takes advantage of the fact that the .shoot memory location is 7.
Title: Re: Shortest Fully Functional Bot
Post by: Drognan on May 05, 2011, 08:12:34 AM
How can we stimulate DNA shortening trought evolution? I found settings "DNA upkeep cost". What is that mean?
Title: Re: Shortest Fully Functional Bot
Post by: ikke on May 05, 2011, 09:37:26 AM
How can we stimulate DNA shortening trought evolution? I found settings "DNA upkeep cost". What is that mean?
cost per turn per bp. Increase this and likelihood of deletions and shorter bots will evolve. This is not hard
Evolving a shorter "fully functional" bot is harder. If the cost of loosing a function is smaller than the gain of a shorter genome energy is gained and the functions will be lost. Evolution is lazy..
Title: Re: Shortest Fully Functional Bot
Post by: ashton1993 on May 15, 2011, 09:51:25 AM
start
*.refvelup ++ .up store
*.refeye dec
*.nrg 5000 >
.repro inc

Okies, I used Panda's revision with PhiNotPi's adjustments, changed 1 add to ++ and also removed the line *.refveldx .dx store because veggie's won't be moving too from side to side much I don't think - 12bp now  :blink:
Title: Re: Shortest Fully Functional Bot
Post by: Panda on May 15, 2011, 12:19:05 PM
Oh... I really doubt that this could get any shorter then.
Title: Re: Shortest Fully Functional Bot
Post by: ashton1993 on May 15, 2011, 01:14:57 PM
well the reproduction gene uses almost HALF the dna... maybe there's a way to shorten that part or may haps duplicate another value and plug it in?
Title: Re: Shortest Fully Functional Bot
Post by: Numsgil on May 15, 2011, 03:27:05 PM
Quote
Reproduce.  This should be controlled with some sort of condition.

Don't forget to check the original requirements.
Title: Re: Shortest Fully Functional Bot
Post by: PhiNotPi on May 15, 2011, 09:25:59 PM
This should work for a bot with 11 BP (It does in theory, but I haven't tested it). 
Code: [Select]
start
*.refvelup ++ .up store
*.refeye dec
*.nrg 222 floor inc 'possibly replace this with *.nrg .repro ceil inc

As the nrg rises, each sysvar is incremented until it reaches 300, or the repro sysvar.  The energy then becomes less than 300, and the cycle repeats.  The 222 floor is to protect the sysvars below 222.  This only works when the starting nrg is less than 300, because the bot would never reproduce.  I also considered *.nrg 300 ceil inc instead becuase it would reproduce whenever nrg was above 300, and there would be not risk of accidently skipping 300 nrg and not reproducing, but there would not longer be any protection of sysvars less than 222. Which one is better?  Both could have side affects in the bot's behavior.

With the "should be controlled with some sort of condition", I said that only to prevent .repro inc and other things that cause cancerous growth.  I never imagined that it would be possible to have a conditionless function that did not cause cancerous growth or destroy the bot's functionallity, and was shorter than five bp.  But since it may be possible to accomplish this with out a condition, I am going to allow conditionless reproduction as long as it is not cancerous and does not destroy functionality.

EDIT:  I have tested both *.nrg 222 floor inc and *.nrg .repro ceil inc.  Both cause terrible side effects.  The first one malfunctions when the bot accidently skips 300 energy, and does not reproduce and becomes massive, so the bot will never reproduce.  The second malfunctions when the bot triggers .fixpos, and the bot can no longer move.
Title: Re: Shortest Fully Functional Bot
Post by: SlyStalker on March 11, 2013, 01:50:08 AM
how about seasnake? it is a very impressive MB (yes, multibot!!!) that has only 1 (yes, 1!!!) gene
Title: Re: Shortest Fully Functional Bot
Post by: Numsgil on March 12, 2013, 02:39:44 AM
Yes but here we're counting base pairs/commands, not genes.  Seasnake is thousands of bps, if I remember right.
Title: Re: Shortest Fully Functional Bot
Post by: SlyStalker on March 12, 2013, 03:01:36 AM
DNA length? Ohh... i thought you mean genes  :blueblob:
Title: Re: Shortest Fully Functional Bot
Post by: Shadowgod2 on September 14, 2013, 01:16:39 AM
ok i'm not new but i am at the same time to darwinbots, but i've been working on this challenge here recently (today) and i have a bot that fills the challenge requirements and is only 12

start
1 .up store                                 move up can be changed if needed 4 i would say is the max speed recomended
*.refeye .shoot ceil dec              shoot if vegi is in front
*.body .repro ceil inc                  reproduce if body is > 300

though it has to be a vegi with 7 eyes in the dna longer than the ones with 11 but they don't shoot. this bot does implement some of your guys ideas, unfortunately it likes to get stuck sometimes.

vegi i made:

cond
 *.nrg 5000 >
start
 50 .repro store
 10 .aimsx store
stop
cond
 *.eye5 0 =
 *.eye5 0 =
 *.eye5 0 =
 *.eye5 0 =
 *.eye5 0 =
 *.eye5 0 =
 *.eye5 0 =
end
Title: Re: Shortest Fully Functional Bot
Post by: Botsareus on September 14, 2013, 02:11:16 PM
ehm, your vegy does not produce it's own chloroplasts.

Also, why the eye restrictions?
In any other simulation your feeder bot will refuse to eat...
Title: Re: Shortest Fully Functional Bot
Post by: Shadowgod2 on September 14, 2013, 06:42:03 PM
It's because it uses refeye => .shoot memory location 7 to id the veg, you could alter the veg as long as it has 7+ eyes and the last useless gene was because i had it in 1 gene but didn't reproduce, and i don't get the chloroplasts genes everyone is talking about, a little insight in that would be nice.
Title: Re: Shortest Fully Functional Bot
Post by: Panda on September 15, 2013, 06:03:11 AM
I'm sure I can do a post about how the chloroplasts work at some point.
Title: Re: Shortest Fully Functional Bot
Post by: Botsareus on September 15, 2013, 09:13:44 AM
Quote
you could alter the veg as long as it has 7+ eyes

That was my point, any robot you design will be limited to a simulation where vegys have 7+ eyes ...  :)
Title: Re: Shortest Fully Functional Bot
Post by: Botsareus on September 15, 2013, 09:24:45 AM
Chloroplasts is our new Beta everyone is talking about, Get a copy from our Announcements section of the Forum (2.46Beta). It works very similar to other versions of the program. The only exception is for vegys you have to add a chloroplasts gene in order for them to be able to get energy from the sun. Here is a simple gene you can use:

cond
  *.chlr
  16000
  <
start
160 .mkchlr store
stop
Title: Re: Shortest Fully Functional Bot
Post by: Shadowgod2 on September 15, 2013, 12:54:49 PM
thanks for the beta and the mutation check in the neural bot challenge too never would have thought of it :)