Bots and Simulations > Tips and Tricks

Logic

<< < (2/2)

Houshalter:
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.

triclops200:
ok, but how would I condense
cond
*.eye5 0 >
start
-1 .shoot store
stop
using logic iside of start

ikke:

--- Quote from: triclops200 ---ok, but how would I condense
cond
*.eye5 0 >
start
-1 .shoot store
stop
using logic iside of start
--- End quote ---

*.eye5 0 >
-1 .shoot store
Gimmick:
http://www.darwinbots.com/Forum/index.php?showtopic=3043

Shasta:
I made an Inline Conditions Tutorial a while ago that may be helpful to you.

Navigation

[0] Message Index

[*] Previous page

Go to full version