Darwinbots Forum

Bots and Simulations => DNA - General => Topic started by: Elite on January 25, 2006, 12:51:59 PM

Title: How do you use 'else'?
Post by: Elite on January 25, 2006, 12:51:59 PM
Can you use 'else' like this?

Code: [Select]
cond
start
stop
else
stop

How do you use 'else'?
Title: How do you use 'else'?
Post by: Numsgil on January 25, 2006, 02:15:58 PM
Yes, you can use it that way.

Also, you don't actually need to stop after body.  It's automatically assumed that when you encounter else you stop the execution before it.

Also, else and body need not be in any particular order.

cond
else
stop

would execute if cond resolved to false.

This is in 2.4, but not 2.37.
Title: How do you use 'else'?
Post by: Elite on January 25, 2006, 04:17:45 PM
Ah, I was wondering why it wasn't working.

So you can make genes in 2.4 that can execute in two ways depending on the condition? Interesting ...
Title: How do you use 'else'?
Post by: Numsgil on January 25, 2006, 05:05:02 PM
Yes, the idea was to increase the possible complexity of DNA structure, to hopefully let more advanced genes develop.  (I'm also working on other methods as we speak.  If you have any ideas yourself feel free to suggest them).