Author Topic: Shortest Fully Functional Bot  (Read 14070 times)

Offline PhiNotPi

  • Bot Builder
  • **
  • Posts: 64
    • View Profile
Shortest Fully Functional Bot
« 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:
  • Search for prey.  This can be as simple as turning or moving foward.
  • Pursue prey.  This means that the bot actively tries to get the enemy within range of attack.
  • Feed off of prey.  This can be as inefficiant as needed, as long as the bot gains net energy from the attack.
  • Not attack conspecs.  It should not treat conspecs as enemies.
  • Reproduce.  This should be controlled with some sort of condition.
  • Populate the sim in F1 conditions.  It will be released into an environment of Alga_Minimalis (modified to increase *.myeye if needed).
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.
I am biased neither towards nor against any single mathematical constant.

Offline Panda

  • Global Moderator
  • Bot Destroyer
  • *****
  • Posts: 476
  • Computer Science Undergraduate (nerd)
    • View Profile
Re: Shortest Fully Functional Bot
« Reply #1 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...
« Last Edit: April 29, 2011, 06:51:47 AM by Panda »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Shortest Fully Functional Bot
« Reply #2 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.

Offline Panda

  • Global Moderator
  • Bot Destroyer
  • *****
  • Posts: 476
  • Computer Science Undergraduate (nerd)
    • View Profile
Re: Shortest Fully Functional Bot
« Reply #3 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
« Last Edit: April 29, 2011, 05:31:53 PM by Panda »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Shortest Fully Functional Bot
« Reply #4 on: April 29, 2011, 06:50:39 PM »
Haha, thanks.  I can write bots but I can't test them at work :P

Offline Panda

  • Global Moderator
  • Bot Destroyer
  • *****
  • Posts: 476
  • Computer Science Undergraduate (nerd)
    • View Profile
Re: Shortest Fully Functional Bot
« Reply #5 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... :)

Offline PhiNotPi

  • Bot Builder
  • **
  • Posts: 64
    • View Profile
Re: Shortest Fully Functional Bot
« Reply #6 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.
« Last Edit: May 01, 2011, 07:20:58 PM by PhiNotPi »
I am biased neither towards nor against any single mathematical constant.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Shortest Fully Functional Bot
« Reply #7 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.

Offline Panda

  • Global Moderator
  • Bot Destroyer
  • *****
  • Posts: 476
  • Computer Science Undergraduate (nerd)
    • View Profile
Re: Shortest Fully Functional Bot
« Reply #8 on: May 01, 2011, 09:20:33 PM »
If only we can get the conspec shorter...

Offline PhiNotPi

  • Bot Builder
  • **
  • Posts: 64
    • View Profile
Re: Shortest Fully Functional Bot
« Reply #9 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.
« Last Edit: May 02, 2011, 04:38:30 PM by PhiNotPi »
I am biased neither towards nor against any single mathematical constant.

Offline Drognan

  • Bot Builder
  • **
  • Posts: 56
    • View Profile
Re: Shortest Fully Functional Bot
« Reply #10 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?

Offline ikke

  • Bot Destroyer
  • ***
  • Posts: 300
    • View Profile
Re: Shortest Fully Functional Bot
« Reply #11 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..

Offline ashton1993

  • Bot Neophyte
  • *
  • Posts: 14
    • View Profile
Re: Shortest Fully Functional Bot
« Reply #12 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:
« Last Edit: May 15, 2011, 09:56:58 AM by ashton1993 »

Offline Panda

  • Global Moderator
  • Bot Destroyer
  • *****
  • Posts: 476
  • Computer Science Undergraduate (nerd)
    • View Profile
Re: Shortest Fully Functional Bot
« Reply #13 on: May 15, 2011, 12:19:05 PM »
Oh... I really doubt that this could get any shorter then.

Offline ashton1993

  • Bot Neophyte
  • *
  • Posts: 14
    • View Profile
Re: Shortest Fully Functional Bot
« Reply #14 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?