### Author Topic: Logic  (Read 2249 times)

#### triclops200

• Bot Neophyte
• Posts: 32
##### Logic
« on: May 16, 2010, 02:00:20 AM »
Can i have more conditions inside of my gene after the cond statement?
I divided by zero and, guess what? The only thing I found out from it is that dividing by zero doesn't work... You are sitting there 9 hours older and thourougly depressed by the amount of work you had to do to finally convince yourself of that.

#### ikke

• Bot Destroyer
• Posts: 300
##### Logic
« Reply #1 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.
« Last Edit: May 16, 2010, 04:32:53 AM by ikke »

#### triclops200

• Bot Neophyte
• Posts: 32
##### Logic
« Reply #2 on: May 16, 2010, 05:55:58 AM »
how do I do it, give an eample plz, someone.
« Last Edit: May 16, 2010, 05:56:23 AM by triclops200 »
I divided by zero and, guess what? The only thing I found out from it is that dividing by zero doesn't work... You are sitting there 9 hours older and thourougly depressed by the amount of work you had to do to finally convince yourself of that.

#### ikke

• Bot Destroyer
• Posts: 300
##### Logic
« Reply #3 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.

#### triclops200

• Bot Neophyte
• Posts: 32
##### Logic
« Reply #4 on: May 16, 2010, 07:14:12 AM »
I cant find your gimmick bot
I divided by zero and, guess what? The only thing I found out from it is that dividing by zero doesn't work... You are sitting there 9 hours older and thourougly depressed by the amount of work you had to do to finally convince yourself of that.

#### Houshalter

• Bot Destroyer
• Posts: 312
##### Logic
« Reply #5 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.
« Last Edit: May 16, 2010, 09:39:08 AM by Houshalter »

#### triclops200

• Bot Neophyte
• Posts: 32
##### Logic
« Reply #6 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
I divided by zero and, guess what? The only thing I found out from it is that dividing by zero doesn't work... You are sitting there 9 hours older and thourougly depressed by the amount of work you had to do to finally convince yourself of that.

#### ikke

• Bot Destroyer
• Posts: 300
##### Logic
« Reply #7 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
« Last Edit: May 16, 2010, 12:13:54 PM by ikke »