Author Topic: Gene structure  (Read 3243 times)

Offline Gantolandon

  • Bot Neophyte
  • *
  • Posts: 8
    • View Profile
Gene structure
« on: October 13, 2008, 03:24:00 PM »
From what I managed to look up on DB Wiki, a gene looks like that:
Code: [Select]
cond
(a condition to activate)
start
(instructions)
stop
But it seems that mutations tend to break this structure very often. For example "cond" is changed into another flow command. It does not seem to disable the entire gene every time it breaks its structure. Sometimes an instruction is ejected outside the gene and stays there.

My questions:

1. Why is there a "stop" command? Changing it doesn't seem to have a great influence on a particular gene.
2. Does the code outside a gene do something?
« Last Edit: December 22, 2011, 11:50:14 AM by Shasta »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Gene structure
« Reply #1 on: October 13, 2008, 03:50:10 PM »
That structure used to be rigidly enforced, but it's been slowly relaxed over time to be more flexible.  Nowadays most of the flow commands are superfluous and you could write an entire bot without using any.  Unfortunately I don't remember the specifics, but it's something like store, inc and dec fizzle (they remove values from the stack, but don't cause changes to memory) if the top value on the boolean stack is false.  A cond statement clears the boolstack and sets it to true.  start logically ANDs all the values on the boolstack together, and stop sets the boolstack to false.

Or something like that   There's a topic somewhere Eric explained how it works, but I don't know where it lives.  The wiki is probably out of date anymore.

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Gene structure
« Reply #2 on: October 13, 2008, 03:50:28 PM »
The definitions of a gene have changed since that was posted. All you need for a gene is either a "start" or an "else" command, the "cond" and "stop" are optional now. The cond flow command is used to reset the condional stack but I think clearbool would work just as well. If there's another gene before the lone start/else command then the gene becomes controlled by the earlier gene.

Not sure about the dna between genes, I don't think its supposed to have an impact though.

Edit:

Nums was too fast for me
« Last Edit: October 13, 2008, 03:52:14 PM by Endy »