Darwinbots Forum

Bots and Simulations => DNA - General => Tips and Tricks => Topic started by: triclops200 on May 16, 2010, 02:00:20 AM

Title: Logic
Post by: triclops200 on May 16, 2010, 02:00:20 AM
Can i have more conditions inside of my gene after the cond statement?
Title: Logic
Post by: ikke on May 16, 2010, 03:11:50 AM
yes. I'm not quite sure if they are ANDded with the pre cond statements though. I've always assumed they are, but I have the vague recollection someone said they're not. If you find out let me know.
Title: Logic
Post by: triclops200 on May 16, 2010, 05:55:58 AM
how do I do it, give an eample plz, someone.
Title: Logic
Post by: ikke on May 16, 2010, 07:03:38 AM
Quote from: triclops200
how do I do it, give an eample plz, someone.
look up my gimmick bot, it's full of it.
Title: Logic
Post by: triclops200 on May 16, 2010, 07:14:12 AM
I cant find your gimmick bot
Title: Logic
Post by: Houshalter on May 16, 2010, 09:37:54 AM
Yes, just use the boolean operators. For example:

cond
*.eye5 0 >
*.refpoison 0 =
start

becomes

start
*.eye5 0 >
*.refpoison 0 =
and

you can also use "OR's" instead of creating new genes so:

cond
*.eye5 0 =
start

cond
*.myeye *.refeye =
start

becomes:

start
*.eye5 0 =
*.myeye *.refeye =
or


As I understand it, it places a true or a false on top of the boolean stack based on the value that the condition command returned (=, <, >, !=, etc.) I'm not sure, but I think "start's" without a condition also return true, or maybe their just skipped if the condition is false. Whatever the case, stores and incs/decs are not activated when theres a false ontop of the stack. I think the default value is true by the way. I hope that makes sense, if you want more detail check the wiki. By the way, theres also XOR and NOT.
Title: Logic
Post by: triclops200 on May 16, 2010, 10:44:22 AM
ok, but how would I condense
cond
*.eye5 0 >
start
-1 .shoot store
stop
using logic iside of start
Title: Logic
Post by: ikke on May 16, 2010, 12:12:27 PM
Quote from: triclops200
ok, but how would I condense
cond
*.eye5 0 >
start
-1 .shoot store
stop
using logic iside of start

*.eye5 0 >
-1 .shoot store
Gimmick:
http://www.darwinbots.com/Forum/index.php?showtopic=3043 (http://www.darwinbots.com/Forum/index.php?showtopic=3043)
Title: Logic
Post by: Shasta on May 16, 2010, 12:22:40 PM
I made an Inline Conditions Tutorial (http://www.darwinbots.com/WikiManual/index.php/Inline_Conditions_Tutorial) a while ago that may be helpful to you.