Page 1 of 1

How do you achieve not ( sniper and mg) tagless?

Posted: 23 Jan 2017, 21:00
by pier4r
Sometimes I would like to retreat or to avoid actions when a sniper and and mg are attacking the self bot.

Now the problem is to say "not ( sniper[attackingSelf, med range] and mg[attackingSelf, med range]". I do not mind to do this with one node, I'm fine with more than one.

I know that

Code: Select all

not (A and B ) = notA or notB


Indeed if I do two parallel nodes (that is the OR), say "not exist sniper[attackingSelf, med range] OR not exist mg[attackingSelf, med range]"

the first node will be true when there is no sniper attacking even if there is an mg attacking, the second node will be true only if there is no mg since the sniper for sure is there and is attacking (due to priority).

Am I missing something? maybe I'm tired but I'm not completely sure that it will work (for the moment I'm using AND and then tags, instead of "notA OR notB without tags"), especially when I extend to 3 conditions (say, adding "if not exist sg[attackingSelf, med range]".

Re: How do you achieve not ( sniper and mg) tagless?

Posted: 23 Jan 2017, 21:15
by Tralalo
If I understand correctly, can't you just put one after the other ?

If any sniper short/medium/long range attacking self exists
|
If any machinefun short/medium range attacking self exists
|
retreat

Re: How do you achieve not ( sniper and mg) tagless?

Posted: 23 Jan 2017, 21:28
by pier4r
If you use positive assertions yes. I'm talking like "not". If "no (sniper and mg)" exist, then push.

Maybe I'm still not clear.

Re: How do you achieve not ( sniper and mg) tagless?

Posted: 23 Jan 2017, 21:39
by Tralalo
Then isn't that what you explained in your first post ?

pier4r wrote:Indeed if I do two parallel nodes (that is the OR), say "not exist sniper[attackingSelf, med range] OR not exist mg[attackingSelf, med range]"

the first node will be true when there is no sniper attacking even if there is an mg attacking, the second node will be true only if there is no mg since the sniper for sure is there and is attacking (due to priority).


pier4r wrote:If "no (sniper and mg)" exist, then push

This means you can push if one of them doesn't exist (or both), so wouldn't this be fine ? :
Image

Re: How do you achieve not ( sniper and mg) tagless?

Posted: 23 Jan 2017, 21:46
by pier4r
Eh, I'm asking exactly this - if it works - because I'm not sure if I miss a case in which one branch is active when I do not want to. Maybe is because I'm tired. On paper it works, in gladiabots I'm not sure (due to priority).

Re: How do you achieve not ( sniper and mg) tagless?

Posted: 23 Jan 2017, 21:59
by Tralalo
I'm not sure what you mean with priority in this case ? You have 4 possible scenarios :
If there is no MG nor Sniper : Left is true (since there is no MG) so you push
If there is a MG but no Sniper : Left is false, right is true (since there is no sniper) so you push
If there is no MG but there is a Sniper : Left is true, right is false so you push
If there is a MG and a Sniper : Left is false, right is false -> don't push

Re: How do you achieve not ( sniper and mg) tagless?

Posted: 23 Jan 2017, 22:08
by pier4r
I mean with evaluation of the nodes. Yes definitely I'm tired, thanks for confirming that it works. Then Ritter in telegram said the same. So I have a way to be tagless on that and with the discussion we also created a little guide about OR and "not (A and B)" for the FAQ.

Re: How do you achieve not ( sniper and mg) tagless?

Posted: 23 Jan 2017, 23:21
by sethcohn
+1, good explanation

Re: How do you achieve not ( sniper and mg) tagless?

Posted: 23 Jan 2017, 23:36
by Aimer RC
pier4r wrote:Sometimes I would like to retreat or to avoid actions when a sniper and and mg are attacking the self bot.


Code: Select all

not (A and B) =/= notA or notB

not (A and B) = not (A and B) or not (B and A)


With this setup, priority doesn't matter:
Image

If you still want your AI to get active if only a sniper OR only a MG is attacking self, put Tralalo's example before this. ;) (To the left)