Darwinbots Forum

Bots and Simulations => DNA - General => Topic started by: Havvy on July 02, 2007, 05:44:54 AM

Title: The OR Command
Post by: Havvy on July 02, 2007, 05:44:54 AM
Code: [Select]
cond
 *.nrg 1000 <
 *.body 50 >
 or
 start

How would this DNA event work?

Also, if directly following a 'else' there is a 'cond', will it work like an elseif?
Title: The OR Command
Post by: Peter on July 02, 2007, 08:58:30 AM
Quote
cond
*.nrg 1000 <
*.body 50 >  
or
start

If one of this two is true, the gene is activated(the commands after start are being executed). This is standing somewhere in the wiki too, it's handy if you look there   . There you can find interesing things.

Quote
Also, if directly following a 'else' there is a 'cond', will it work like an elseif?

I am not sure, I tried it once but then I could'nt do it, maybe I was just doing it wrong  .

You mean something like this I gues

Quote
cond
*.nrg 1000 <
*.body 50 >  
or
start


else         (the else part I gues you mean)
   cond
   start
   else
   stop
stop
Title: The OR Command
Post by: Numsgil on July 02, 2007, 08:41:45 PM
else gets activated whenever start doesn't.  The most straightforward example would be something like this:

cond
*.nrg 5000 >
start
50 .repro store
else
0 .repro store
stop

This basically acts as an if-else block.