Darwinbots Forum

Bots and Simulations => DNA - General => Topic started by: strangers on December 10, 2006, 01:45:33 PM

Title: Tie Feeding Idea
Post by: strangers on December 10, 2006, 01:45:33 PM
Well, I'm working on tie feeding and was wondering if I could modify the tie feeding gene from Purple Youko's 2.13 tutorial to allow a bot to pick up a veggie or bot, attach to it for set amount of time and extract a set amount of energy then release it, reproduce, and repeat. This is all I have:
Code: [Select]
cond
*.eye5 77 !=
*.eye5 30 >
*.eye4 *.eye6 =
*.refeye *56 !=
*.numties 0 =
start
*55 .tie store
*56 .readtie store
stop

cond
*.numties 0 >
start
-1 .tieloc store
*.refenergy 2 div .tieval store
*55 .tienum store
stop

Cond
*.trefeye *56 =
start
*55 .deltie store
stop
*55 Has been set as a random number before hand.
*56 Has been set for the .refeye value before hand.
Any suggestions?
And I also wondering if I could modify the gene to cause it to attach to a veg and another bot and make it transfer waste from the veg into the first bot and then into the second bot until it reaches the waste threshold and dies. Wait, does reaching the waste threshold make a bot die?.....
Title: Tie Feeding Idea
Post by: Numsgil on December 10, 2006, 02:22:30 PM
Welcome

Quote from: strangers
Well, I'm working on tie feeding and was wondering if I could modify the tie feeding gene from Purple Youko's 2.13 tutorial to allow a bot to pick up a veggie or bot, attach to it for set amount of time and extract a set amount of energy then release it, reproduce, and repeat.

Yes, this is possible.  However, PY's original tutorial is a little old, so you're going to need to play with things a little.  The condition *.eye5 77 != probably won't work as advertised anymore, although that's a minor point.  You've also "misspelled" refnrg as refenergy.  If you load your bot into the program, right click on it, and select "robot details", you can look at what the program thinks the DNA looks like.  This is a good way for finding these sorts of problems.  They'll show up as 0s.

More specific DNA help usually starts to fry my brain.  Elite is good at manipulating DNA, so I'll leave the rest to him.

Quote
And I also wondering if I could modify the gene to cause it to attach to a veg and another bot and make it transfer waste from the veg into the first bot and then into the second bot until it reaches the waste threshold and dies. Wait, does reaching the waste threshold make a bot die?.....

Bots whose pwaste + waste exceed the waste threshold will start to behave funny, because random numbers will start to be stored into the genome.  It usually causes cell death one way or another after a thousand cycles or less.
Title: Tie Feeding Idea
Post by: strangers on December 10, 2006, 02:46:21 PM
The reason that I typed .refnrg as .refenergy was because I was typing from memory I guess I missed it.
And can anyone suggest a way to make the bots not fire ties at each other immediatly after birth? Wait, if when the bot gives birth their both facing each other the wouldn't this code make them rotate away from eachother before they fire the ties?
Code: [Select]
'Initialize
'*************
cond
*.robage 0 =
start
1 .tie store
13 56 store
100 rnd 55 store
mult 648
stop

cond
*.robage 1 =
start
1 .deltie store
stop

'Reproduction
'****************
cond
*.nrg 10000 >
start
mult 628
50 inc
20 .repro store
stop

cond
*.robage 199 =
start
0 .repro store
stop

cond
*.robage 199 >
*.nrg 10000 >
start
mult 628
50 inc
20 .mrepro store
stop

‘Perform the rotation
'************************
cond
start
.aimdx store
stop
This is the actuall reproduction gene with the added turning gene added to the initialize gene.
Title: Tie Feeding Idea
Post by: EricL on December 10, 2006, 04:02:11 PM
You are missing the value that you actually want to store into .aimdx in your turning gene.  Try

cond
start
628 .aimdx store
stop
Title: Tie Feeding Idea
Post by: Sprotiel on December 10, 2006, 05:49:48 PM
Quote from: EricL
You are missing the value that you actually want to store into .aimdx in your turning gene.  Try

cond
start
628 .aimdx store
stop
No, he's not! The value stored is put on the stack in previous genes, with the "mult 628" statements.
Title: Tie Feeding Idea
Post by: strangers on December 10, 2006, 07:06:08 PM
I guess I might aswell show the whole thing incase I did make any errors:
Code: [Select]
'Initialize
'*******
cond
*.robage 0 =
start
1 .tie store
13 56 store
100 rnd 55 store
mult 648
stop


cond
*.robage 1 =
start
1 .deltie store
stop

'Wide search 1
'************
cond
*.eye1 *.eye5 >
start
mult -100
stop

'Wide search 2
'************
cond
*.eye9 *.eye5 >
start
mult 100
stop

' Simple search pattern
'*******************
cond
  *.eye3 *.eye5 >
start
mult -25
stop

'Simple search pattern part 2
'************************
cond
  *.eye7 *.eye5 >
start
mult 25
stop

' Moving
'**********
cond
  *.vel 30 <
  *.refeye *56 !=
start
  30 *.vel sub 2 div .up store
stop

' Obtaining Food
'*************
cond
  *.eye5 40 >
start
-1 .shoot store
stop

'Avoid conspecifics
'***************
cond
*.refeye *56 =
start
mult 180
stop

' Gene 12
cond
*50 0 >
start
mult 628
50 dec
stop

‘Rotate back and continue feeding
'****************************
cond
*50 0 >
start
mult 628
50 dec
stop

'Reproduction
'****************
cond
*.nrg 10000 >
start
mult 628
50 inc
20 .repro store
stop

cond
*.robage 199 =
start
0 .repro store
stop

cond
*.robage 199 >
*.nrg 10000 >
start
mult 628
50 inc
20 .mrepro store
stop

‘Perform the rotation
'************************
cond
start
.aimdx store
stop

'Tie Feeding
'****************
cond
*.eye5 30 >
*.eye4 *.eye6 =
*.refeye *56 !=
*.numties 0 >=
*.numties 3 <
start
*55 .tie store
*56 .readtie store
stop

cond
*.numties 0 >
start
-1 .tieloc store
-1000 .tieval store
*55 .tienum store
stop

Cond
*.trefeye *56 =
start
*55 .deltie store
stop

'Slime Managemant
'************************
cond
*.slime 90 <
start
100 .mkslime store
stop

'Waste Management
'*************************
cond
*.waste 100 >
start
1 .backshoot store
-4 .shoot store
*.waste .shootval store
stop
end
Please, feel free to point out anything that needs reworking.
EDIT: Removed mutant, stretched page too much.
Title: Tie Feeding Idea
Post by: EricL on December 10, 2006, 11:47:22 PM
Quote from: Sprotiel
No, he's not! The value stored is put on the stack in previous genes, with the "mult 628" statements.
Guess I should spend more than 10 seconds before I reply next time...  
Title: Tie Feeding Idea
Post by: Jez on December 11, 2006, 02:45:25 AM
Quote from: strangers
And can anyone suggest a way to make the bots not fire ties at each other immediatly after birth? Wait, if when the bot gives birth their both facing each other the wouldn't this code make them rotate away from eachother before they fire the ties?
Code: [Select]
'Initialize
'*************
cond
*.robage 0 =
start
1 .tie store
13 56 store
100 rnd 55 store
mult 648
stop

cond
*.robage 1 =
start
1 .deltie store
stop

You could remove the 1.tie store instruction in the first gene to stop it tieing to it parent at birth, it may be using a different method to tie to parent at birth though. This would leave them tied by the birth tie and make the second gene, pointless. I'd have to check order of instructions to see if it is turning away from parent before tieing to parent 2bh. I'll see if I can find the post and link it.

Regards the full dna you posted, gene 12 & 13 are the same, you don't have a body check in the repro genes which may cause your bots to get smaller and smaller. Other than that, seeing as I haven't tried it or unless you've spotted something it's not doing which it should be, it looks fine.
I'm guessing that second lot of full DNA is a mutated bot. Pointless me reading it really, every time you repeated it or, pretty much, every bot you check should show different changes in the dna! That -34 in gene 3 for instance is a mutation.

I'm guessing this is your first bot, as soon as it's working to your satisfaction and if you'd like to give it a name I'll put it in the bestiary and hopefully run it in the league soon.

EDIT

Order of Actions (http://www.darwinbots.com/Forum/index.php?showtopic=180)

So yes, it is turning before firing tie at parent, (if it is not already deleting birth tie) perhaps moving the turning command to the second gene would help. Also you can disable the other turning genes by adding *.robage 1 > to their conditions.
Ah, no conspec recognition for firing -1 shots so parent would get shot.

I'd have to check each of these things by watching bot, your code may well use other methods to deal with them.
Title: Tie Feeding Idea
Post by: strangers on December 11, 2006, 06:49:20 PM
Well then I can remove the tie firing and deleting parts, I was using them to allow them to seperate before they start shooting eachother. Conspec recognition would be helpful with -1 shots. I just noticed the rotate and cont. feeding gene is in there twice. Well, I'll make the modifications, repost the dna.
What would a gene(s) look like that would make a bot drop a tie on another bot or veg after 19 cycles, make a 180 rotation, refire the tie, and then continue feeding. I can do most of it but I'm not sure how to make the bot drop the tie after 19 cycles.
Title: Tie Feeding Idea
Post by: Jez on December 12, 2006, 05:00:06 AM
I'm useless with ties but I guess something like;

cond
*.counter 19 =
start
1 .deltie store
stop

You just need the bot to count the 19 cycles after it fires the tie and then use the count as a condition for deleting the tie. (*.counter is not a sysvars)
Title: Tie Feeding Idea
Post by: Numsgil on December 12, 2006, 04:26:41 PM
You could use .timer instead of .counter (seeing as .counter doesn't exist).  .timer is automatically incremented every cycle, and is gaurenteed to be synchronized and heritable to children bots.
Title: Tie Feeding Idea
Post by: strangers on December 12, 2006, 07:23:56 PM
This code would tell the bot to extract half of the tied bots energy, correct?
Code: [Select]
cond
*.numties 0 >
start
-1 .tieloc store
*refnrg 2 div -1 mult .tieval store
*55 .tienum store
stop
Title: Tie Feeding Idea
Post by: Jez on December 12, 2006, 07:41:21 PM
PY tie feeder tutorial (http://www.darwinbots.com/WikiManual/index.php?title=Tie_Feeder_Tutorial)
(Tie feeding used to be unlimited, but ties now (after DBv2.12))
Quote
have a built in limit of 1000 energy points per cycle in either direction.

Which AFAIK is still true. Otherwise it would have worked.
Title: Tie Feeding Idea
Post by: strangers on December 12, 2006, 07:48:25 PM
I've already read that tutorial.
Title: Tie Feeding Idea
Post by: Jez on December 12, 2006, 08:10:00 PM
I'm not doubting that, you obviously have a pretty good idea of how tie bots work.

All I was pointing out was that your gene would have worked but for the 1000nrg/cycle limit on transfers.

The only reason I quoted the source was because I had to go check my facts before posting.

It is the in-game DB help file as well if you haven't seen that. Can't think of anywhere else, off hand, that might have information you'd find useful for writing tie bots. (Other than the incomplete Wiki which I know you'll have looked at!)
Title: Tie Feeding Idea
Post by: strangers on December 12, 2006, 08:24:29 PM
Then couldn't I alter the code to say something like:
Code: [Select]
cond
*.numties 0 >
*.counter 0 =
start
-1 .tieloc store
-1000 .tieval store
*55 .tienum store
stop

cond
*.numties 0 >
*.counter 1 =
start
-1 .tieloc store
-1000 .tieval store
*55 .tienum store
stop


cond
*.numties 0 >
*.counter 2 =
start
-1 .tieloc store
-1000 .tieval store
*55 .tienum store
stop
etc., etc, etc.
Title: Tie Feeding Idea
Post by: Numsgil on December 13, 2006, 12:34:38 AM
You can try to pull more than a 1000 nrg per turn, but only 1000 nrg is actually ever going to be pulled through.  So your gene will work -except- it won't be able to always pull exactly half of the other bot's energy.
Title: Tie Feeding Idea
Post by: Jez on December 13, 2006, 07:04:52 AM
Quote from: strangers
Then couldn't I alter the code to say something like:

Yes. I would suggest you condense it a bit though, for example;

Code: [Select]
def counter 990 'sets memory location for counter

cond
*.numties 0 >
*.counter 19 < 'saves you having to do gene 19 times!
start
-1 .tieloc store
-1000 .tieval store
*55 .tienum store
.counter inc 'increases counter by 1
stop

'then your other genes like;

cond
*.numties 0 >
*.counter 19 =
start
'do what you want on 19th turn
stop

cond 'safety gene to reset counter if lose tie or turn 19 reached and deleted tie
*.numties 0 =
*.counter 0 !=
start
0 .counter store
stop

cond 'may not want this but it's in case some-bot messes with mem location you used for counter!
*.counter 19 >
*.counter 0 < or
start
0 .counter store
stop

er, don't think I understood the word 'condense' properly!
Title: Tie Feeding Idea
Post by: strangers on December 13, 2006, 06:46:26 PM
do you realy need the "*.counter 0 !=" line since thats taken care of in the next gene? Next, is extracting nrg the same with a hardened tie as is with a unhardened one? or do you have to use a different command, such as .sharenrg?
Edit:
Would this gene (modified from a gene in symbioticus v2.5) need to come before, or after the energy feeding gene?
Code: [Select]
cond
*.numties 0 >
*.treffixed 1 =
start
1 .tienum store
.fixpos .tieloc store
0 .tieval store
stop
And how would I make it not pay attention to the veggies its tied to?
Title: Tie Feeding Idea
Post by: Jez on December 14, 2006, 04:35:35 AM
Quote from: strangers
do you realy need the "*.counter 0 !=" line  since thats taken care of in the next gene?

That gene deals with *.counter being 1-19 when there are no ties, because they have snapped or target died etc
The last gene I put in in case you are writing a competitive bot, it deals with *.counter being a negative value or a value over 19. Just in case another bot fires something that changes the value of .counter to something outside the range of values you are using.

Quote
Next, is extracting nrg the same with a hardened tie as is with a unhardened one? or do you have to use a different command, such as .sharenrg?

A hardened tie is the same as unhardened when it comes to sharing energy; .sharenrg calculates the total energy for all the bots you are tied to and then the number you put into .sharenrg becomes the percentage of the total energy you receive, it doesn't need .tienum to do this. I presume that you can only share at 1000 nrg per cycle max but I don't know this.


Quote
Would this gene (modified from a gene in symbioticus v2.5) need to come before, or after the energy feeding gene?
Code: [Select]
cond
*.numties 0 >
*.treffixed 1 =
start
1 .tienum store
.fixpos .tieloc store
0 .tieval store
stop
Firstly you need to have stored a value in .readtie before you can use *.treffixed,(is a fixed value and only needs to be set once unless you wish to change it). Second I would put this gene after the energy feeding gene, it changes the values of .tieloc and .tieval and the DNA will only use the last value entered for each cycle. Third, if it is after the energy feeding gene it will mean you no longer get any energy through that tie.

I think changing the condition to *.treffixed 0 = because this gene would only work atm if target bot was fixed. Maybe adding *.treffixed 1 = to the energy feeding gene would then make them fire individually. I presume you want to fix the target and then feed off it. Many competitive bots have an unfix gene which would make this gene keep firing though.

Quote
And how would I make it not pay attention to the veggies its tied to?
Basically something like cond/*.trefeye 0 = would identify the bot on the end of tie as a veg.

What you are now talking about is multiple ties by the sound of it though. AFAIK you need a different tie number for each tie, if you called them all tie1 then the DNA would think you are talking about the last tie created. If you are going to stick to a veg until you see a target bot and then once tied to that bot deal with that bot without firing anymore ties then it might not be that hard.

/me waits for someone like Num's to come correct any mistakes...  
Title: Tie Feeding Idea
Post by: strangers on December 14, 2006, 07:05:49 PM
Ok, I get the safety gene now.
I think I'll just leave fixing/unfixing alone for now.
Could't I use a tie/info shot to change the in/out values of a veg so the bot could identify it?
Title: Tie Feeding Idea
Post by: Jez on December 15, 2006, 12:30:37 AM
Quote from: strangers
Could't I use a tie/info shot to change the in/out values of a veg so the bot could identify it?

Yes. There are chameleon bots that read the value of .in and change their value to the same so you'd need to use it with a *.refeye 0 = cond. Don't use the in/out on it's own to identify anything.

Saying that, someone came up with the idea of making .out1 the same as *.myage so *.refage *.in1 = became a useful ID, chameleon bots just imitate the value they can see.