Author Topic: Tie Feeding Idea  (Read 8403 times)

Offline strangers

  • Bot Neophyte
  • *
  • Posts: 37
    • View Profile
Tie Feeding Idea
« 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?.....

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Tie Feeding Idea
« Reply #1 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.
« Last Edit: December 10, 2006, 02:22:54 PM by Numsgil »

Offline strangers

  • Bot Neophyte
  • *
  • Posts: 37
    • View Profile
Tie Feeding Idea
« Reply #2 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.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Tie Feeding Idea
« Reply #3 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
Many beers....

Offline Sprotiel

  • Bot Destroyer
  • ***
  • Posts: 135
    • View Profile
Tie Feeding Idea
« Reply #4 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.

Offline strangers

  • Bot Neophyte
  • *
  • Posts: 37
    • View Profile
Tie Feeding Idea
« Reply #5 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.
« Last Edit: December 11, 2006, 06:35:51 PM by strangers »

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Tie Feeding Idea
« Reply #6 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...  
Many beers....

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
Tie Feeding Idea
« Reply #7 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

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.
« Last Edit: December 11, 2006, 02:58:22 AM by Jez »
If you try and take a cat apart to see how it works, the first thing you have in your hands is a non-working cat.
Douglas Adams

Offline strangers

  • Bot Neophyte
  • *
  • Posts: 37
    • View Profile
Tie Feeding Idea
« Reply #8 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.

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
Tie Feeding Idea
« Reply #9 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)
If you try and take a cat apart to see how it works, the first thing you have in your hands is a non-working cat.
Douglas Adams

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Tie Feeding Idea
« Reply #10 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.

Offline strangers

  • Bot Neophyte
  • *
  • Posts: 37
    • View Profile
Tie Feeding Idea
« Reply #11 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

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
Tie Feeding Idea
« Reply #12 on: December 12, 2006, 07:41:21 PM »
PY 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.
« Last Edit: December 12, 2006, 07:41:44 PM by Jez »
If you try and take a cat apart to see how it works, the first thing you have in your hands is a non-working cat.
Douglas Adams

Offline strangers

  • Bot Neophyte
  • *
  • Posts: 37
    • View Profile
Tie Feeding Idea
« Reply #13 on: December 12, 2006, 07:48:25 PM »
I've already read that tutorial.

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
Tie Feeding Idea
« Reply #14 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!)
If you try and take a cat apart to see how it works, the first thing you have in your hands is a non-working cat.
Douglas Adams