Author Topic: Codules  (Read 15400 times)

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
Codules
« Reply #15 on: March 24, 2006, 05:46:11 PM »
Pretty confusing system, I can't quite envision it.  It is definetely not obvious to me that infinite loops are impossible. Hmm, I need to draw this out...  

Also, seems to me that codule 1 with code

cond
start
1 goto
1 goto
stop

would result in 25 repeats of itself.  Is that right?  Does each self-refferring goto command multiply the number of repeats by the allowed number of codule references on the stack?

If that's true then it seems like CPU taxation might be pretty heavy.  Say you allow 100 repeats and then codule 1 becomes

cond
start
1 goto
1 goto
1 goto
stop

That would mean 100^3 (million) repeats of this codule.  Are you sure it won't slow down the program?
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Codules
« Reply #16 on: March 24, 2006, 06:02:54 PM »
It makes a bit more sense if you're familiar with how computers execute programs, it mimics that quite closely.

In you example:

start
1 goto
1 goto

The actual number of executions this would cause is complicated to calculate, but it's like this:

x = number of 1 goto statements (in this case 2)
y = maximum tree depth

(x ^ (y - 1) + 1) * ceil(y / 2)

or something similar.  Which would be a good example of why keeping the maximum tree depth fairly low is a good idea, now that I think of it.

A million calls would slow the program down no doubt.  1000 might be a reasonable upper bound on the number of calls that's realistic.
« Last Edit: March 24, 2006, 06:17:00 PM by Numsgil »

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Codules
« Reply #17 on: March 24, 2006, 06:25:12 PM »
I worry about getting sidetracked in this thread.  I love this kind of dicsussion, but I should be clear that I am not militant in my position.  I fully supoport the proposal as made including the proposal on preventing infinite loops.  Codules are a great thing, I love the idea.

I remain of the general philosphy that the engine should attempt to do exactly what the DNA says without underlying, hidden safeguards that bots and selection in general are unaware of but I yield (for now) to the voice of precedence and experience. :)
Many beers....

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Codules
« Reply #18 on: March 25, 2006, 05:34:19 AM »
IMO codules are a great idea. They're like subroutines. They help break up the code and form more complex DNA structures.

A few questions:

1) If I fire this virus:
Code: [Select]
start
goto 5
stop
Then when the virus enters a bot it will call their codule 5, correct?

2) What about bots deleting and writing to codules? (might start a new thread about this)

3) Can I fire my root DNA as a virus  :P

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Codules
« Reply #19 on: March 25, 2006, 07:20:57 AM »
Quote
IMO codules are a great idea. They're like subroutines. They help break up the code and form more complex DNA structures.

A few questions:

1) If I fire this virus:
Code: [Select]
start
goto 5
stop
Then when the virus enters a bot it will call their codule 5, correct?
Right.  So it would probably primarily be for sharing DNA with conspecs, a kind of horizontal gene transfer.

Quote
3) Can I fire my root DNA as a virus  :P

I'm not sure.  I'm leaning towards no, since it's insanely powerful.

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Codules
« Reply #20 on: March 29, 2006, 11:07:49 PM »
The general cost increase for goto use could be log based. The gradual increase in nrg expenditures should naturally limit infinite-loop bots. It would also be a good incentive for authors to make use of codules efficently. :)

Possibly we could have a timer that'll stop execution somehow after a certain amount of time. Kind of artificial but would fix the main problem.

Evolution would probably fix the problem for us so I myself don't see what the problem would be.

Seriously the only way an infinite loop bot would likely come to exist, would be if we made one.  :)

Offline Greven

  • Bot Destroyer
  • ***
  • Posts: 345
    • View Profile
Codules
« Reply #21 on: March 30, 2006, 11:32:24 AM »
I did just read the first 5-10 lines of your first post Num, and I think GREAT idea, I really like it alot.... Open up for alot of possibilities....
10010011000001110111110100111011001101100100000110110111000011101011110010110000
011000011000001100010110010111101001110100110010111100101000001000001111001011101
001101001110011011010011100011110100111000011101100100000100110011010011100110110
010110000011100111101001110110111101011101100110000111101001101001110111111011101
01100100000111010011010001100001110111010000010001001000010100001

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Codules
« Reply #22 on: May 04, 2008, 01:48:31 AM »
I think real DNA works in a similar way. We should really have a control section, a piece of DNA that can refer to the codules, which have no other way of being executed or referencing other codules. This way you end up with a whole lot of packages that do not tangle up with each other and can be activated as many times as needed by a detached piece of code (The traditional DNA section).
Btw. just had a look at the code repository, it looks as though the Chromosomes just add an unnecessary complexity level.
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Codules
« Reply #23 on: May 04, 2008, 04:27:42 AM »
For simple bots, yes, chromosomes add an extra level of complexity.  But my thinking is that it would allow for something like diploidness.  Basically two genomes sharing control of the final behavior of a bot.  Also, they feed in to the concept of viral code.  Of course, it's been a while since I played around in the DNA code, so it might be time to crack open that specific nut again and reevaluate the different ideas.

Offline gymsum

  • Bot Destroyer
  • ***
  • Posts: 215
    • View Profile
Codules
« Reply #24 on: May 06, 2008, 02:29:38 PM »
I cant see a reason for codules... CUrrently if you dont want something to activate, you make conditions taht deactivate the genes, and at the end of a cycle active genes become phenotypic. I dont think any rael life DNA has a skip in it, its all write, read, stop commands. Adding a codule to skip to a section of dna seems just impractical, for most smaller bots, and with mutations they would still fail to do what you want.

Offline Trafalgar

  • Bot Destroyer
  • ***
  • Posts: 122
    • View Profile
Codules
« Reply #25 on: May 06, 2008, 05:32:29 PM »
Quote from: gymsum
I dont think any rael life DNA has a skip in it, its all write, read, stop commands.

On the contrary, real life DNA is actually closer to codules:

Quoting from http://www.sciam.com/article.cfm?id=regulating-evolution, from page 3 :
Quote
Most important to our discussion here is the fact that some genes have many separate enhancers. This is particularly true for genes that encode proteins that shape anatomy. Each enhancer independently regulates the expression of the gene in different parts of the body and at different times in the animal’s life cycle, such that the complete expression of a gene is a patchwork of multiple, independently controlled sites of expression. These enhancers enable the same gene to be used many times in different contexts and thus greatly expand the functional versatility of individual genes.

A gene involved in coloring the body parts of the fruit fly illustrates the modular logic of this gene regulation system. The somewhat confusingly named Yellow gene encodes a protein that promotes the formation of black pigmentation (mutant flies without this protein are Yellow). The Yellow gene has separate enhancers that activate it during the development of a variety of fly body parts, including the wings and abdomen.

Because the Yellow gene plays a role during the development of so many tissues, mutations in the gene itself could be disastrous if they alter or disable the function of the protein; they would affect the function of the Yellow pigmentation protein throughout the organism. In contrast, changes in just one of the gene’s enhancers will affect only the function of that enhancer and only the Yellow gene expression governed by that enhancer, leaving the expression and function of the protein in other tissues unchanged.

The evolutionary implications of the modular regulation of body-patterning genes are profound. In theory, mutations in enhancers would allow individual body traits to be selectively modified without changing genes or proteins themselves. And in the past few years, direct evidence has emerged that this is frequently how the evolution of various body parts and patterns has occurred.

However, it isn't quite the same.

(Same source)
Quote
We have found that in spotted species, the Yellow protein is produced at very high levels in the cells that will make the spot and at low levels in the rest of the wing cells. In unspotted species, Yellow is made only at low levels throughout the wing, generating just a light dusting of black pigment.

[...]

In unspotted species, there is an enhancer that drives Yellow expression in a low uniform pattern in the wing. This wing-enhancer activity generates the fly wings’ light-gray color. When the corresponding piece of DNA was analyzed from a spotted species, we found that it drives both this low-level pattern and the intense spot pattern of gene expression. What has happened in the course of evolution of spotted species is that new binding sites for transcription factors made in the wing evolved in the Yellow wing-enhancer DNA sequence. These changes created an expression pattern—wing spots—without altering where the Yellow protein is made or how it functions elsewhere in the body

Have a look at this: http://www.sciam.com/media/inline/2A5F4661...AA704DF19_5.jpg (if the link works from off-site)

« Last Edit: May 06, 2008, 05:40:57 PM by Trafalgar »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Codules
« Reply #26 on: May 06, 2008, 06:10:18 PM »
If you look at DNA strictly from a computer science/language standpoint, it's missing functions.  That's basically what a codule is: a way to write code that uses functions.  Functions are good because they promote code reuse.  And of course, if you don't want to use Codules you don't have to, so it falls into the realm of "backwards compatible language enhancement".  Which just rolls off the tongue so elegantly   I think it might be iambic.
« Last Edit: May 06, 2008, 06:10:42 PM by Numsgil »

Offline gymsum

  • Bot Destroyer
  • ***
  • Posts: 215
    • View Profile
Codules
« Reply #27 on: May 07, 2008, 11:35:51 PM »
Quote from: Numsgil
If you look at DNA strictly from a computer science/language standpoint, it's missing functions.  That's basically what a codule is: a way to write code that uses functions.  Functions are good because they promote code reuse.  And of course, if you don't want to use Codules you don't have to, so it falls into the realm of "backwards compatible language enhancement".  Which just rolls off the tongue so elegantly   I think it might be iambic.

I understood everything up till the seond sentence. Why do we want to promote codule reuse? I thought thats what mutations got rid of.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Codules
« Reply #28 on: May 07, 2008, 11:43:42 PM »
Exactly.  Mutations tend to break copy+paste code, so if all the code is routed through a single place, like a codule, then a single mutation impacts all the code.

Offline gymsum

  • Bot Destroyer
  • ***
  • Posts: 215
    • View Profile
Codules
« Reply #29 on: May 08, 2008, 12:06:32 AM »
One function that would be nice would be gene copy, this is what makes human dna so stable, we have a lot of junk to mutate without much effect.