AND NOT before AND

Coding-related discussion: OpenPPL (Poker Programming Language) and internal OpenHoldem-script
Partypoker562
First blood
First blood
Posts: 19
Joined: Fri Jan 27, 2023 1:35 pm

AND NOT before AND

Post by Partypoker562 »

What's the difference between the two codes below:


WHEN HaveSet AND NOT OneCardStraightPossible AND OneCardFlushPossible AND Bets = 0 AND Raises = 0 Call FORCE

WHEN NOT OneCardStraightPossible AND HaveSet AND OneCardFlushPossible AND Bets = 0 AND Raises = 0 Call FORCE


Is it better to have "AND NOT" before "AND" code? Or is it the same? I read this on the manual.
Alex
Site Admin
Site Admin
Posts: 3112
Joined: Sun Mar 26, 2017 5:58 pm

Re: AND NOT before AND

Post by Alex »

Partypoker562 wrote: Sat Feb 25, 2023 3:46 am What's the difference between the two codes below:


WHEN HaveSet AND NOT OneCardStraightPossible AND OneCardFlushPossible AND Bets = 0 AND Raises = 0 Call FORCE

WHEN NOT OneCardStraightPossible AND HaveSet AND OneCardFlushPossible AND Bets = 0 AND Raises = 0 Call FORCE


Is it better to have "AND NOT" before "AND" code? Or is it the same? I read this on the manual.
it's the same, but i always prefer to use brackets with "NOT":
WHEN HaveSet AND (NOT OneCardStraightPossible) AND OneCardFlushPossible AND Bets = 0 AND Raises = 0 Call FORCE

also this style looks better for me:
WHEN HaveSet AND !OneCardStraightPossible AND OneCardFlushPossible AND Bets = 0 AND Raises = 0 Call FORCE

! and NOT is the same
Partypoker562
First blood
First blood
Posts: 19
Joined: Fri Jan 27, 2023 1:35 pm

Re: AND NOT before AND

Post by Partypoker562 »

I haven’t used brackets for “NOT” coding. Which one is correct:

AND NOT (OneCardStraightPossible)

AND (NOT OneCardStraightPossible)
Alex
Site Admin
Site Admin
Posts: 3112
Joined: Sun Mar 26, 2017 5:58 pm

Re: AND NOT before AND

Post by Alex »

Partypoker562 wrote: Wed Mar 01, 2023 8:48 pm I haven’t used brackets for “NOT” coding. Which one is correct:

AND NOT (OneCardStraightPossible)

AND (NOT OneCardStraightPossible)
i prefer this:
AND (NOT OneCardStraightPossible)
Partypoker562
First blood
First blood
Posts: 19
Joined: Fri Jan 27, 2023 1:35 pm

Re: AND NOT before AND

Post by Partypoker562 »

What about in situation when you're using "NOT" with "OR?" Which one should I use?

WHEN HaveTopPair AND NOT (HaveBestKicker OR HaveSecondBestKicker OR HaveThirdBestKicker) AND RaiseTo 0.20*PotSize FORCE
WHEN HaveTopPair AND (NOT HaveBestKicker OR HaveSecondBestKicker OR HaveThirdBestKicker) AND RaiseTo 0.20*PotSize FORCE
WHEN HaveTopPair AND (NOT HaveBestKicker OR NOT HaveSecondBestKicker OR NOT HaveThirdBestKicker) AND RaiseTo 0.20*PotSize FORCE
maxxous
Low pair
Low pair
Posts: 44
Joined: Tue Sep 01, 2020 7:59 am

Re: AND NOT before AND

Post by maxxous »

Partypoker562 wrote: Thu Mar 02, 2023 10:56 pm What about in situation when you're using "NOT" with "OR?" Which one should I use?

WHEN HaveTopPair AND NOT (HaveBestKicker OR HaveSecondBestKicker OR HaveThirdBestKicker) AND RaiseTo 0.20*PotSize FORCE
WHEN HaveTopPair AND (NOT HaveBestKicker OR HaveSecondBestKicker OR HaveThirdBestKicker) AND RaiseTo 0.20*PotSize FORCE
WHEN HaveTopPair AND (NOT HaveBestKicker OR NOT HaveSecondBestKicker OR NOT HaveThirdBestKicker) AND RaiseTo 0.20*PotSize FORCE
The 1st does not work, the second and the third works.
You have to remove the AND before the RaiseTo
Not.png
Not.png (36.72 KiB) Viewed 995 times
Partypoker562
First blood
First blood
Posts: 19
Joined: Fri Jan 27, 2023 1:35 pm

Re: AND NOT before AND

Post by Partypoker562 »

Thanks for letting me know. I think I'm going to use the third code for my bot. I find it interesting that the PPL manual from bonusbots.com says to use the first one. Are they giving bad information or something? Error in the manual. I'm glad that I found it.

They have many code examples like this: AND NOT (HaveBestKicker OR HaveSecondBestKicker OR HaveThirdBestKicker) Call FORCE.
maxxous
Low pair
Low pair
Posts: 44
Joined: Tue Sep 01, 2020 7:59 am

Re: AND NOT before AND

Post by maxxous »

Shanky bot and OpenHoldem have a few difference, it is better to check when using PPL over OH.
I also recommend that you read the OPPL manual from OH. ;)
Alex
Site Admin
Site Admin
Posts: 3112
Joined: Sun Mar 26, 2017 5:58 pm

Re: AND NOT before AND

Post by Alex »

in terms of brackets and logical expressions old PPL and new OpenPPL are the same, as i remember.

WHEN HaveTopPair AND NOT (HaveBestKicker OR HaveSecondBestKicker OR HaveThirdBestKicker) RaiseTo 0.20*PotSize FORCE
WHEN HaveTopPair AND (NOT HaveBestKicker OR HaveSecondBestKicker OR HaveThirdBestKicker) RaiseTo 0.20*PotSize FORCE

those 2 are just different. In 1st case you are applying NOT to the whole expression in brackets. In 2nd line you are applying it only to HaveBestKicker.
Just different logical meaning.

WHEN HaveTopPair AND (NOT HaveBestKicker OR NOT HaveSecondBestKicker OR NOT HaveThirdBestKicker) AND RaiseTo 0.20*PotSize FORCE
again, different logical expression.
You need to understand how OR, AND, and NOT works. Individually and together. I guess you can google easily. All programming languages use similar logic
Partypoker562
First blood
First blood
Posts: 19
Joined: Fri Jan 27, 2023 1:35 pm

Re: AND NOT before AND

Post by Partypoker562 »

So, which one do I use If I have hand$A2 and the flop is A59 and I want the bot to RaiseTo 0.20*Potsize FORCE?
Post Reply