Author Topic: General approach to metabolism  (Read 7854 times)

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
General approach to metabolism
« on: March 18, 2005, 03:06:08 PM »
OK, I worked out the system.  It is very easy to start using, it requires only small changes in existing bots and will be completely backwards-compatible for any bot that is designed with metabolism in mind.  Even if we change the metabolism pathways a lot in the future.  The system is very intuitive, so can be picked up quickly by anyone.

This is very general description, I don't want to go into details and balances.  If you have doubts - ask "how will this work" and I'll explain.  

Finally, this is a summary of many ideas from different people, so don't blame it all on me :)  But do praise me a lot :)


1. We make a molecule array.  Things like venom, poison, fat and energy are now referred to that array instead of usual memlocs.  The molecules can also be addressed as numbers (not by name).  I'd say 256 slots should be enugh.

2. We make an enzyme array.  The enzymes Nums desribed are processed only once, when robot is created (or born) and those found will have 1, those absent - 0.  This is minimal level of enzyme and it never gets lower.  The amounts can go up automatically or bots can make them through DNA.  Enzymes are slowly decayed (but never below 1).  I'd say we'll need 2048 slots for enzymes.

3. Molecules are divided into two types - terminal and intermediate.  In a chain of A>B>C>D, A and D are terminal, while B and C are intermediate.  Terminal molecules are not acted upon unless there is a command from DNA.  Intermediate molecules are automatically processed, but this processing can be overriden by DNA commands.  Only terminal molecules are passed over during feeding.

4. Stomach size is defined by the total number of enzymes.  Its content  is purged every N cycles, which is also defined by total number of enzymes (the more enzymes the longer food stays).  Molecules from stomach are transferred to bot at the rate corresponding to the number of specific enzymes they have (no DNA commands here).  If there is no enzyme, the molecule is not absorbed but is dropped into env. grid (not as waste, as molecule) during purging.

5. Digesting is done by DNA command.  All you need to say is molecule's name (or number) and "break" command.  The program checks if bot has that molecule and if it has appropriate enzymes and will convert the molecule to energy.  The rate of conversion is proportional to the amount of specific enzyme bot has.  The program actually runs the broken molecule through intermediates, but bot does not have to see this.  Digesting can be improved by specifying the path of digestion.  The most efficient way is to spell out each and every step in DNA - then bot can get more energy and it can get it faster.

6. Same goes for making molecules.  All you need to say is molecules' name and "make" command in DNA (no more store commands here).  Program will do it for you.  But you'll be better if you spell out the path.
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2554
    • View Profile
    • http://kuro-tejina.com
General approach to metabolism
« Reply #1 on: March 18, 2005, 03:29:28 PM »
Like most of it with a few minor problems

Quote
Stomach size is defined by the total number of enzymes. Its content is purged every N cycles, which is also defined by total number of enzymes (the more enzymes the longer food stays).

Purging every N cycles is not very feasible. What if the robot has just eaten 1 cycle before the purge? Does he lose it all. Or are you saying that each food particale only stays in the stomach for N cycles? If so then nice idea but very difficult to implement as each particle of food in each robot's stomach would have to have its own counter. Processor intensive doesn't even come close. Billions of food particles could be present in all the robots combined stomachs at any given time.

Better to purge a small percentage of the stomach contents each cycle

(Also have a secondary storage area like intestines which stores undigested food particles and waste products that will collectively be contained by .waste which needs to be manually purged just like it is now before the bot gets sick.)

Quote
5. Digesting is done by DNA command. All you need to say is molecule's name (or number) and "break" command. The program checks if bot has that molecule and if it has appropriate enzymes and will convert the molecule to energy. The rate of conversion is proportional to the amount of specific enzyme bot has. The program actually runs the broken molecule through intermediates, but bot does not have to see this. Digesting can be improved by specifying the path of digestion. The most efficient way is to spell out each and every step in DNA - then bot can get more energy and it can get it faster.

6. Same goes for making molecules. All you need to say is molecules' name and "make" command in DNA (no more store commands here). Program will do it for you. But you'll be better if you spell out the path.

Not so keen on this in its present form. I see problems with running this from DNA. It would be impossible under the present DNA scanning to perform more than one of your break or make commands per cycle as subsequent instances will simply overwrite the first one such that only the very last one would ever be performed.

Another possibility would be to design custom paths in a setup section of the DNA file in a similar way to the enzyme list. Maybe only allow a limited number of path slots (say 10). Then they can run automatically each cycle or be accessed by a series of sysvars like make1, make2....break1, break2. These controls will take up minimal space in the sysvars registry and will allow the custom make and break paths to be executed from DNA.

How does that sound?

 :D  PY  :D
« Last Edit: March 18, 2005, 03:30:12 PM by PurpleYouko »
There are 10 kinds of people in the world

Those who understand binary.

and those who don't

:D PY :D

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
General approach to metabolism
« Reply #2 on: March 18, 2005, 03:44:31 PM »
About purging:  It was Nums idea.  The timer starts when bot eats something.  N cycles later ALL food is purged even the one just swallowed and timer is reset.  If N is >10, this should not handicap bots too much.

About multiple break commands: Is there absolutely no way to make it so that "molecule array" is changed after each command?
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
General approach to metabolism
« Reply #3 on: March 18, 2005, 03:57:15 PM »
I am confused.  Again, how come "break" commands will override each other?  Store commands don't.

You can say

1 2 store
3 4 store
5 6 store

Same here:
you have molecules called 1, 2, and 3

1 break
2 break
3 break

"break" command simply means decrease value in molloc (molecular location) 1, increase value in molloc 2

Works like this:

Before: 9 0 0 (these are values in mollocs 1, 2,3 correspondingly)
Cycle 2: 8 1 0
Cycle 3: 7 1 1
Cycle 4: 6 1 2

Should work, or am I dumb?
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2554
    • View Profile
    • http://kuro-tejina.com
General approach to metabolism
« Reply #4 on: March 18, 2005, 04:00:07 PM »
NO NO NO NO NO NO to infinity.

I Hate that idea.

Besides which that would really penalize heavy duty tank type bots or a bot who spends a lot of energy powering up a shot.

Just imagine that a stray shot containing tiny amounts of food hits this bot and sets off the timer.

Then a couple of cycles later he manages to land a really big shot on his target grabbing about 1000 energy in one go after spending about 200 to make the supershot. It takes at least 3 cycles for the shot to reach its target, then another 3 to get back. That is 8 cycles gone before he fills his stomach.

Cycle 9 he gets to digest about 50 points of the 1000 that he just went to a whole bunch of trouble and expense to get.

Then 950 points of food is dumped to the grid!

Terrible Terrible idea.

 :(  PY  :(
There are 10 kinds of people in the world

Those who understand binary.

and those who don't

:D PY :D

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
General approach to metabolism
« Reply #5 on: March 18, 2005, 04:10:55 PM »
OK, I don't care about the exact mechanics of pooping.  As long as there is stomach and enzymes are needed to absorb stuff, I am OK.  These are details.

What about break/make commands?
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2554
    • View Profile
    • http://kuro-tejina.com
General approach to metabolism
« Reply #6 on: March 18, 2005, 04:15:34 PM »
Quote
I am confused.  Again, how come "break" commands will override each other?  Store commands don't.

You can say

1 2 store
3 4 store
5 6 store

Same here:
you have molecules called 1, 2, and 3

1 break
2 break
3 break

"break" command simply means decrease value in molloc (molecular location) 1, increase value in molloc 2

Works like this:

Before: 9 0 0 (these are values in mollocs 1, 2,3 correspondingly)
Cycle 2: 8 1 0
Cycle 3: 7 1 1
Cycle 4: 6 1 2

Should work, or am I dumb?
Hmm hadn't thought of it that way. Would that work I wonder?

Let's work through this logically.

The store command is an "operator" rather than a command

That is to say that it manipulates the stack and nothing else. That is how come we can use it multiple times in the genome, just like you can with inc, dec, add etc.
You can't do this with .refup or .mkshell or any of the sysvars.

Operators are scanned during DNA parsing and are used only to manipulate values on the stack and in memory locations. Each robot's entire DNA file is parsed this way on each cycle.

At the end of the parsing cycle, the program passes the robot memory files over to the main loop which then acts on whatever value is now in each memory location.
At this stage the actual DNA is irrelevent since we only care about memory locations. All actions are performed during this step of the program based only on memory locations and the values in them therefore only one instance of a sysvar command can be executed per cycle.

Now could we put digestion into the DNA parser?

I think it would be possible but it would be extremely difficult as the entire parsing engine would have to be changed quite dramatically so that it is able to recognise your new functions as operators instead of sysvars.
I could do it, but wouldn't it just be easier to add a small bank of sysvars which wouldn't involve any changes to the layout of the program wahtsoever?

How many molecules are we talking about here. If you want to add 100s then it will be worth changing the parser but if there are just 10 it will be so much easier to add a bank of sysvars.

 :D  PY  :D
There are 10 kinds of people in the world

Those who understand binary.

and those who don't

:D PY :D

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
General approach to metabolism
« Reply #7 on: March 18, 2005, 04:20:08 PM »
(I'll try to prove my point again , good luck to me)

How about a three enzyme system, and one gas in the e-grid.

The Robots starts out Having enzymeA:

Quote
cond
start
20
.useenzymeA
store
stop

It slowly eats up all the gas in the e-grid and mutates.

It cant have bouth enzymeB and enzymeC in the same time. ex:

Quote
cond
start
20
.useenzymeB
store
20
.useenzymeC
store
stop
can't happen

then if it evolves to use enzymeB (e-grid gas ran out slowly)

we will have

Quote
' Alga minimalis
'
' Vegetable
'
' This robot has a single gene,
' necessary for it to reproduce.
' Energy is given to it by the sun!!!,
' forget about the Fe#5!"autotroph" box.

cond
start
  20
  .useenzymeB
  store
  50
  .repro
  store
  15
  .aimdx
  store
  50 'no enzymeC so does not work
  .up 'no enzymeC so does not work
  store 'no enzymeC so does not work
 -1 'no enzymeC so does not work
  .shoot 'no enzymeC so does not work
  store 'no enzymeC so does not work
stop
end

or it can evolve to use enzymeC (e-grid gas ran out slowly, time to eat the alga)

Quote
cond
start
  20
  .useenzymeC
  store
  20 ' No way , enzymeC found so this does not work
  .useenzymeB ' No way , enzymeC found so this does not work
  store ' No way , enzymeC found so this does not work
  20 ' Dam,it No more gas
  .useenzymeA ' Dam,it No more gas
  store ' Dam,it No more gas
  50 'I hunt for food now.
  .up 'I hunt for food now.
  store'I hunt for food now.
 -1 'I hunt for food now.
  .shoot 'I hunt for food now.
  store 'I hunt for food now.stop
end

But hey , thats only the simple and the programer frandly idea , who needs it right?
« Last Edit: March 18, 2005, 04:27:23 PM by Botsareus »

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2554
    • View Profile
    • http://kuro-tejina.com
General approach to metabolism
« Reply #8 on: March 18, 2005, 04:27:01 PM »
It is too simple in many ways, you couldn't go far with only 3 enzymes. What we need are infinite variability of enzymes.

On the other hand it involves exactly what I am trying to avoid at all costs.
It make the DNA directly handle the mechanics of digestion.
I don't like that idea one little bit.
Digestion has to be automatic or every bot built without those specific controls will be unable to survive. This would efectively wipe out every existing robot completely. We would have empty league table and a bunch of pissed off bot-programmers.

 <_<  PY  <_<
There are 10 kinds of people in the world

Those who understand binary.

and those who don't

:D PY :D

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
General approach to metabolism
« Reply #9 on: March 18, 2005, 04:29:09 PM »
Thats why you make the program "patch" every single bot to use a sertain enzyme in the bigging of the simulation.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
General approach to metabolism
« Reply #10 on: March 18, 2005, 04:47:41 PM »
Py, you are saying we change the system on the bots without effecting the DNA? There is practicaly no way to do that.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2554
    • View Profile
    • http://kuro-tejina.com
General approach to metabolism
« Reply #11 on: March 18, 2005, 05:05:15 PM »
There are loads of ways to do it

here is one way to do it.

Infinite (almost anyway) kinds of enzymes defined in hexidecimal bit patterns and stored in a pattern at the end of the DNA. User programmable and mutates.

At the start of the sim or when a robot is born, the list of enzymes contained in the pattern is scanned into the robots enzyme array and all present enzymes are turned on for that robot.

The robot shoots normally.

It diverges into two different possible systems at this point.

Method 1
  • Enzymes in stomach
  • Undigested food comes back in the returned -2 shot.
  • If the necessary enzymes are present the food is digested automatically else they are added to the waste of the robot and need to be pooped.
Method 2
  • Enzymes in shots.
  • All enzymes possible for this robot are present in the shot that it fires.
  • Target bot is partially digested by the shot provided that the correct enzymes are present in it, and according to their efficiency rate.
  • Returned -2 shot contains energy just like it does now.
  • Energy goe into a storage stomach where it is slowly absorbed by the robot. Excess energy is lost to the e-grid as waste or heat or anything we like.
No direct DNA control at all. Everything behind the scenes and fully automated yet also able to evolve with successive generations.

 :D  PY  :D
There are 10 kinds of people in the world

Those who understand binary.

and those who don't

:D PY :D

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2554
    • View Profile
    • http://kuro-tejina.com
General approach to metabolism
« Reply #12 on: March 18, 2005, 05:09:18 PM »
Where the enzyme interacts with the e-grid directly then it will do so automatically as a robot with the correct enzyme passes over an e-grid location that contains a substance that it can metabolize.

No direct DNA control. Automated, fully backward compatible with older bots and able to mutate.

 :D  PY  :D
There are 10 kinds of people in the world

Those who understand binary.

and those who don't

:D PY :D

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2554
    • View Profile
    • http://kuro-tejina.com
General approach to metabolism
« Reply #13 on: March 18, 2005, 05:10:22 PM »
Simple, Easy, To the point and minimal hassle

 :D  PY  :D
There are 10 kinds of people in the world

Those who understand binary.

and those who don't

:D PY :D

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
General approach to metabolism
« Reply #14 on: March 18, 2005, 05:10:37 PM »
Ok , what If I want to write a simple robot that only eats the e-grid gas and reproduces , under your system how will dna of this robot look like?

(This robot is not a plant or a hunter, It eats a gas that slowly runs out in the e-grid)
« Last Edit: March 18, 2005, 05:11:31 PM by Botsareus »