Darwinbots Forum

Bots and Simulations => DNA - General => Topic started by: Botsareus on March 07, 2005, 09:04:56 PM

Title: How Long To Wait For Children to...
Post by: Botsareus on March 07, 2005, 09:04:56 PM
How do I make a parent bot pass on its memory locations to its children?
I heard I have to wait n cycles? How long do you have to wait for children to get the parent's memory locations? n = ?

Do I have to add some special code so those memory locations will be copied?

Also, I heard that there is a certain range of memory that does not get copied, what's that range?

 :sleep: Bau  :sleep:  :help:
Title: How Long To Wait For Children to...
Post by: Numsgil on March 07, 2005, 10:16:25 PM
Memory locations 971 through 990 are copied.

This was added in 2.32.  Here's the readme entry:

5  Racial memory. During the birthing cycle, baby robots copy certain information from the memory of the parent. The copied locations are 971 through 990 and one location is copied each cycle after the 20th cycle of the birth tie. Robots who cut their gestation periods short will miss out on the valuable opportunity to pass on vital information to their offspring.

Someday I'll get to removing or shortening this 20 cycle wait period.
Title: How Long To Wait For Children to...
Post by: Endy on March 08, 2005, 01:24:15 AM
That'll be nice, considering that it can cause share feeding parents to kill their own children whenever birth-tie seperation doesn't occur correctly.

Endy B)
Title: How Long To Wait For Children to...
Post by: Botsareus on March 08, 2005, 02:33:27 PM
Thx Num
Title: How Long To Wait For Children to...
Post by: Old Henk on February 09, 2006, 09:49:59 AM
I read this on the WIKI, what about it? Is this 2.4 only or 2.37 also?

A catch to using racial memory is that the memloc needs to be empty prior to the information being coppied. 971 would need to be 0 for the parent to transfer it's value.
Link to WIKI article on racial memory (http://www.darwinbots.com/WikiManual/index.php?title=Racial_memory)

Thx in advance :)

Henk
Title: How Long To Wait For Children to...
Post by: PurpleYouko on February 09, 2006, 10:12:04 AM
Hmm

Interesting.

That doesn't really make sense. If memlocs 971 through 990 are zero in the parent then no data will be transferred since there is nothing there to transfer.
Therefore it is a prerequisite that the parent needs something there to make use of the feature.

In the baby, the values in those memlocs will always be zero at birth so unless the DNA specifially puts something there at a very young age (probably overwriting any transferred data) there is no reason why we would even need to consider the catch

There is nothing that I am aware of in the code that prevents writing to a non-zero memory location. More likely, the values that are copied could be overwritten by careless DNA programming.

What you would need to do is to prevent baby from writing to those memory locations until he is at least age 21 and also check for zero values present before writing information. It should all work just fine then.
Title: How Long To Wait For Children to...
Post by: Numsgil on February 09, 2006, 11:43:48 AM
I noticed that the other day too, and I'm not sure what it means.

Stranger still, I went to see who added that line, and I think it was me (IP address, no s/n).

I have no idea personally.  Someone should find that bit of code and figure out what the heck me/whoever was talking about.
Title: How Long To Wait For Children to...
Post by: Griz on February 09, 2006, 01:58:26 PM
was 66.91.141.218 on 27 Sep 2005
http://www.darwinbots.com/WikiManual/index...=next&oldid=258 (http://www.darwinbots.com/WikiManual/index.php?title=Racial_memory&diff=next&oldid=258)
other contributions:
http://www.darwinbots.com/WikiManual/index...t=66.91.141.218 (http://www.darwinbots.com/WikiManual/index.php?title=Special:Contributions&target=66.91.141.218)
so that looks like Endy
Title: How Long To Wait For Children to...
Post by: Numsgil on February 09, 2006, 04:53:24 PM
ah, then Endy must know what he meant :P
Title: How Long To Wait For Children to...
Post by: Endy on February 09, 2006, 05:00:36 PM
Yeah that was me. Found it out working with various epigenetic bots. The main problem is that the earlier epigen systems I was using would always activate at age zero. Before the parent could transfer it's values...

Now I use .delgene inc to delete the first gene after the first bots have stored their initial epigen values. To reset for the children in case the parent dies prior to transfer, I'll use something like *.robage 40 > to prevent any accidental overwrites. I think I've got an epigen bot somewhere in the bestiary :)
Title: How Long To Wait For Children to...
Post by: Elite on February 10, 2006, 11:32:26 AM
Here's your epigen bot Endy:
A Family 2 (http://forum.darwinbots.com/index.php?showtopic=687)

Maybe you could use racial memory for doing interesting things with antbots

Or you could use it to allow a bot to see how many cycles have passed since the start of the sim:

Sounds like there's some interesting things that you can do with this.
Title: How Long To Wait For Children to...
Post by: Endy on February 10, 2006, 04:48:09 PM
There he is :D

There is a way to make a timer(though Nums new sysvar is much easier I imagine). You inc one of the epigen values whenever it is not zero, when it reaches some number you set it to one again.

I think you could theorectically make a complete mini clock using these although I've never actually tried :lol:

Still haven't figured out some of the tricks to using it myself. It works well enough to find the most useful values for just about any settings, allowing bots to randomize some of their values and allowing natural selection to sort out the fittest. What I'd like to figure out is how to make a bot more like the real thing, able to go from one genotype to multiple phenotypes and back to one genotype again.

I'm thinking there's also some sort of time rule on wether to use dna or epigenics; dna seems better for long term stability while epigenics allows short term flexability.

I think the ant's in/out usage already counts as a form of epigenics. The only real definition is the ability to pass on learned information from parent to child.
Title: How Long To Wait For Children to...
Post by: Numsgil on February 10, 2006, 05:56:57 PM
Makes you wonder how much of real organisms' characteristics, especially higher animals, are epigenetic in nature.

If you isolate some human babies in a room with each other, with no outside intervention (though you somehow give them food and water, etc.) will they develop language on their own?
Title: How Long To Wait For Children to...
Post by: Elite on February 10, 2006, 06:20:20 PM
Nums:
Hmm, science fiction seems to love the concept of a genetic memory - a child would have all the memories of all that came before it. Neat idea. You wouldn't need to learn the basics of anything - you would posess all the knowlage of your entire species, no need for school. You would be partially immortal (arguably better than immortality because you don't get aged immortals clogging up the planet) since all your memories would live on in your children. There would be no need to investigate history since you could simply remember all of your species' history.

Endy:
DNA and epigenetics, hmm. How about having a bot with a long and redundant genetic code that 'switches on' and 'switches off' genes randomly and 'trades' genes. Similar to what bacteria do in real life with plasmids. I made a virus to 'spread genes' but it ended up rather sticky  :wacko: :

Code: [Select]
cond
start
*.genes rnd .mkvirus store
150 .vshoot store
stop

I was trying to artificially accelerate evolution but I just ended up with evil super-plants  :evil:  :evil:  :evil:

How about trading genes using viruses, with 'install code' in each gene that:
1) Prevents non-conspecs from actvating the gene
2) Deletes the gene that it's supposed to replace (each gene has a corresponding  memloc telling the other genes where it is using *.thisgene)

Horisontal gene transfer would prevent muller's ratchet (http://en.wikipedia.org/wiki/Muller's_ratchet) and help evolution along

Just an idea  :D
Title: How Long To Wait For Children to...
Post by: Endy on February 10, 2006, 10:53:21 PM
Yeah, I've had my own super evil plants :evil:  Nasty things, wiped out my whole population.  :lol:  Before the extinction though the bots did start showing signs of horizontal gene transfer :)  I was able to watch multiple bots from divergent lines become canni's(a "better" form) simultaneously. I also saw signs of selfish gene transfer going on, forever reproducing bots spreading their "defect" to others.

Quote
1) Prevents non-conspecs from actvating the gene

Now this is a great idea. It would take a little bit of work but maybe adding:
Code: [Select]
*971 .out1 store
and
A B *.out1 sgn mult store
would do the trick. Using epigenics to set out1, ought to keep the veggies from using the genes for a long while at least.

Quote
2) Deletes the gene that it's supposed to replace (each gene has a corresponding memloc telling the other genes where it is using *.thisgene)

Tricky to manage unfortunatly. It's next to impossible to tell which gene is which from inside the dna. Could just delgene a random gene whenever genelen is greater than initial. That would maintain the size, just not sure what other effects it would have...

Quote
Makes you wonder how much of real organisms' characteristics, especially higher animals, are epigenetic in nature.

If you isolate some human babies in a room with each other, with no outside intervention (though you somehow give them food and water, etc.) will they develop language on their own?

I think they would develop the basics. Fortunatly the knowledge can be learned, so if it's been learned once it's possible to learn anew.

I think as mamals in general we use epigenetics to add like another layer of coding above the dna. The dna serves as a sort of template and the epigenetics as a sort of super template.

I think memory has to be impermanent, its more designed to cope with a rapidly changing world than to keep track of past events. I think memory basically takes experiences and compresses them into a simpler form. We can easily transmit these nuggets to others but not the entire memory. As individuals and a species we keep the most important recent information, but the older/less useful info is lost.
Title: How Long To Wait For Children to...
Post by: PurpleYouko on February 11, 2006, 11:48:47 AM
Quote
There would be no need to investigate history since you could simply remember all of your species' history.

There is a pretty big flaw in this concept.
Babies would only be able to remember stuff that happened directly to their ancestors. For example I was born in England from English parents so I would know nothing about the American Civil war or the abolition of slavery or Samarais in Japan.

What you end up with is not the sum of all knowledge but a bunch of branches all leading in different directions and all remembering back to a common ancestor. An incredibly sucular society in which particular knowledge and skills are passed down certain bloodlines. Imagine if only one blood line knew the way to make a certain weapon and others conspired to wipe out that bloodline so that the weapon could not be made any more.
Lost technology.

Definitely the realm of Science Fiction.
Title: How Long To Wait For Children to...
Post by: Elite on February 11, 2006, 01:54:38 PM
Yeah, that's a good point. You'd probably end up with many feuding lineages, which are only allowed to have one heir so as not to split the line.
How about genetic memory with telepathy and a hive mind  :D

Imagine the DNA length though  :wacko: you'd need rather alot of base pairs

I once read a book with a similar idea. Rather than a genetic memory the aliens shared memories via special nodules that contained memories. The nodules could be removed and eaten by another one of the aliens to pass on memories.


Speaking of memory, is it possible, or even practical or advantageous, to create a bot with a memory?
Title: How Long To Wait For Children to...
Post by: Numsgil on February 11, 2006, 03:05:24 PM
I think it's possible, but exactly what would you remember?

You could remember what defenses and attacks the enemy's using, and adapt appropriately.  I believe that's what Excalibur or another one of Lights' bots does.

Beyond that, I'm not sure.
Title: How Long To Wait For Children to...
Post by: Endy on February 12, 2006, 02:20:37 AM
Sounds like the idea about communicating bots. It's simple enough for them to communicate easily some 27 "symbols" or a whopping 2187(2.4) just via in/out and memloc/memval.

Same question though, what should they talk about? :wacko:

Most of the bots we make have been mainly action/reaction based while trying to keep all defenses at a maximum level.

Perhaps with a memory a bot could direct defenses better. If it knows that it is likly to be attacked with a particular shot type, it could increase the amount of substance counter it has.
Title: How Long To Wait For Children to...
Post by: Numsgil on February 12, 2006, 03:08:29 AM
You could use memory to determine (not easily mind you) the conspec recognition system of your foe.

For instance, try mimicing memloc/memval pair.  If the other bot still attacks you, you know that's not working.  You could try using the Umbrella Draconis method, and modify the myeye variable.  If that doesn't work you could try mimicing the in/out method.

Once (if) you figure out the method, you can mercilessly exploit it, even pass it on to others.
Title: How Long To Wait For Children to...
Post by: Welwordion on April 18, 2006, 07:03:18 PM
I just do not get it, first I tried to pass on a location did not work, then I tried to inc 971 in each generation
but it stay 1 regardless of generation, just how is this supposed to work?
Title: How Long To Wait For Children to...
Post by: Numsgil on April 18, 2006, 07:13:30 PM
Let me go hunting through the code to see what I can come up with.

Okay.

PY apparently decided to stash this neat little feature inside the function that handles tie forces (specifically making ties longer and shorter - tielen).

The function was overhauled as part of the physics in 2,4, and so the feature was inadvertantly lost.

It will need to be reimplemented in 2.4 (and please don't stick it in with TieHooke )
Title: How Long To Wait For Children to...
Post by: PurpleYouko on April 19, 2006, 10:56:33 AM
Quote
PY apparently decided to stash this neat little feature inside the function that handles tie forces (specifically making ties longer and shorter - tielen).
I did??  

Why would I do that I wonder?

Is it in the section of the routine where the birth ties are handled? let me go check a minute.

Yup. It's in "Linklen" in the physics module. Right in the section where birth ties have always been handled.

Here's the code (from 2.37.6) if anyone wants it.
Code: [Select]
            If Abs(rob(t).Ties(j).last) > 1 Then
              rob(t).Ties(j).last = rob(t).Ties(j).last - Sgn(rob(t).Ties(j).last)
              If rob(t).Ties(j).last > 47 And rob(t).Ties(j).last < 68 Then 'should copy the memory locations 971 to 990 from parent to child. One per cycle.
                If rob(t).mem(1038 - rob(t).Ties(j).last) = 0 And rob(rob(t).Ties(j).pnt).mem(1038 - rob(t).Ties(j).last) <> 0 Then
                  rob(t).mem(1038 - rob(t).Ties(j).last) = rob(rob(t).Ties(j).pnt).mem(1038 - rob(t).Ties(j).last)
                End If
              End If
            End If

Seems like about the only place in the code where it would work properly, especially since all the birth ties have always been handled in this routine. can't believe it took us all so long to figure out where it was located.  

Stifftie is in this routine too  
Title: How Long To Wait For Children to...
Post by: EricL on April 19, 2006, 02:05:30 PM
2.42.3 will have this functionality added.  I need to ask couple of newbie questions to make sure what I do matches expected behaviour.

Q) How long should birth ties last by default?  The code in 2.4 says 100 cycles.  Is this right?  I thought I read on the wiki somewhere that birthties should last 20 cycles.

Q) When should locations 971 to 990 should be copied from parent to child?  Over the first 20 cycles of the child's life?  Over some other 20 cycle period?  All at once?    The code above seems to indicate that this should occur over the period when the child is between age 33 and 52 cycles.

Nevermind.  I just read the rest of the thread.
Title: How Long To Wait For Children to...
Post by: PurpleYouko on April 19, 2006, 02:22:43 PM
Quote from: EricL
2.42.3 will have this functionality added.  I need to ask couple of newbie questions to make sure what I do matches expected behaviour.

Q) How long should birth ties last by default?  The code in 2.4 says 100 cycles.  Is this right?  I thought I read on the wiki somewhere that birthties should last 20 cycles.

Q) When should locations 971 to 990 should be copied from parent to child?  Over the first 20 cycles of the child's life?  Over some other 20 cycle period?  All at once?    The code above seems to indicate that this should occur over the period when the child is between age 33 and 52 cycles.

The ties(j).last value starts out at 100 and is reduced by one point per cycle until it reaches zero.

That part of the program is intrinsic to birth ties and has always been in Darwinbots in exactly the same form. Birth ties last 100 cycles, then disappear. Normal ties harden after 20 cycles.

The memory transfer in the code I gave above, starts with ties(j).last at a value  of 68. (Can't think why I used that value   ) and continues till it is 40. This represents 32 and 52 cycles after birth respectively.

I see no reson that this couldn't be made to work at cycles 1 till 20. Just substitute  99 and 79 as the "last" values.
Even better, allow this 20 cycle window to be user definable, starting at cycle 1 (last=99)  to cycle 80 (last =19)
Title: How Long To Wait For Children to...
Post by: Numsgil on April 19, 2006, 02:29:36 PM
I also vote in favor of memory being copied during cycles 1 through 20 instead of after.

In fact, I see no reason why in later versions (C++) we couldn't expand this to be a memory location each cycle.  Say 901 through 1000.  You'd have to move some sysvars around but that's not a huge deal at all.
Title: How Long To Wait For Children to...
Post by: EricL on April 19, 2006, 02:34:21 PM
I have no problem figuring out what code does or making it do what I want it to do.  What I have problems with is figuring out what others actually want it to do.

So, should it be cycles 1-20 in the offsprings life or should I emulate 2.36.7 and make it cycles 33 through 52?  Or perhaps make it happen instantly as Nums seems to suggest earlier in this thread.  Any of these is trivial to implement.  Just tell me which people prefer.

I think it is inadvisable to make it user configurable.  People seem to have problems enough with user definable settings complaining for example, about how waste causes them problems in 2.4X where simply setting the waste threshold to 32000 would disable the feature.
Title: How Long To Wait For Children to...
Post by: Numsgil on April 19, 2006, 02:36:22 PM
I think cycles 1-20 is best, otherwise no one's ever going to use it (liek before).
Title: How Long To Wait For Children to...
Post by: EricL on April 19, 2006, 02:58:34 PM
Then that is how I will do it though I'm sure someone someday will complain that their 2.3X genetic memory bot doesn't work quite as they expect in 2.4x...
Title: How Long To Wait For Children to...
Post by: Numsgil on April 19, 2006, 03:36:23 PM
I don't think you have to worry too much about that since Endy is about the only person who tried using it successfully.
Title: How Long To Wait For Children to...
Post by: Welwordion on April 19, 2006, 03:42:11 PM
To be honest I wanted to use racial memory just yesterday and It did not work like I wanted I to ^^
Title: How Long To Wait For Children to...
Post by: PurpleYouko on April 19, 2006, 03:58:30 PM
It works in 2.37.6  
Title: How Long To Wait For Children to...
Post by: Welwordion on April 19, 2006, 04:23:36 PM
yeah as well as delgene, which also only works in 2.3x but I really wanted to use distance(although I could improvise with pythagoras) well the best feature of 2.4 are that bots can be smaller so its easier to identify parent and child  
Title: How Long To Wait For Children to...
Post by: EricL on April 19, 2006, 11:20:30 PM
Okay.  Genetic Memory is working 2.42.3.  See #7 in this topic (http://www.darwinbots.com/Forum/index.php?act=ST&f=10&t=1240&st=0).

Quote from: Welwordion
yeah as well as delgene, which also only works in 2.3x ...

Welwordion, if you can be more specific about exactly what does not work regarding delgene in 2.4 (provide an example bot perhaps which demonstrates the issue or just describe it so I know what to look for) I will make it work in 2.42.3.
Title: How Long To Wait For Children to...
Post by: Welwordion on April 20, 2006, 12:48:51 AM
First endys gene from the wiki about racial memory:

'gene1 sets 971 to 1 on the first cycle then deletes gene1
cond
start
971 inc
.delgene inc
stop

second a little twist

'gene1 sets 971 to 1 on the first cycle then deletes gene1
cond
start
971 inc
*.thisgene .delgene store
stop


Both do not delete anything.