Coding preflop

Coding-related discussion: OpenPPL (Poker Programming Language) and internal OpenHoldem-script
Post Reply
CoffeeShark
Fish
Fish
Posts: 9
Joined: Tue May 30, 2023 11:15 am

Coding preflop

Post by CoffeeShark »

Hello,

I'm a bit lost creating the preflop section of my code.

I am creating a profile to play spins, and I want to define a preflop strategy to play according to position and effective stack. Is this possible?

I want to define the strategy for BTN, SB and BB. I have already created lists of hands for each action in the different legs of effective stack. How should I indicate it in the code?

I would appreciate an example!
Alex
Site Admin
Site Admin
Posts: 3112
Joined: Sun Mar 26, 2017 5:58 pm

Re: Coding preflop

Post by Alex »

CoffeeShark wrote: Thu Jun 08, 2023 10:45 pm Hello,

I'm a bit lost creating the preflop section of my code.

I am creating a profile to play spins, and I want to define a preflop strategy to play according to position and effective stack. Is this possible?

I want to define the strategy for BTN, SB and BB. I have already created lists of hands for each action in the different legs of effective stack. How should I indicate it in the code?

I would appreciate an example!
i think you should start from learning basic OpenPPL language: https://documentation.help/OpenPPL/Bets ... sizes.html
and may be combine it with exploring some finished profile. Like you can grab some free profile or buy cheap one from our store. Just for learning and may be use it as template.

What you describe is simple. Something like:

Code: Select all

WHEN InButton and listMyButtonRaise and (EffectiveMaxStacksizeOfActiveOpponents > 30 and EffectiveMaxStacksizeOfActiveOpponents<50) RaisePot Force
CoffeeShark
Fish
Fish
Posts: 9
Joined: Tue May 30, 2023 11:15 am

Re: Coding preflop

Post by CoffeeShark »

Thanks Alex,
Yes, I am studying everything you mention but in some cases the documentation is not clear.

Do you think the following code is correct?

Code: Select all

WHEN InButton
 WHEN EffectiveMaxStacksizeOfActiveOpponents > 30
  WHEN ##list1##
   RaiseMax Force
  WHEN ##list2##
   RaiseMin Force
   WHEN 3bet
      ActionAllIn
      WHEN AllIn
        Call Force
  WHEN ##list3##
   RaiseMin Force
   WHEN 3bet
      Call Force
      WHEN AllIn
      Fold Force
  WHEN ##list4##
   RaiseMin Force
   WHEN 3bet
      Fold Force
      WHEN AllIn
      Fold Force
  ELSE
   Fold Force
The four lists refer to hands that we must play in BTN with more than 30 effective stack blinds.
##list1## includes hands that must be played all-in preflop
##list2## includes hands that must be opened, vs 3bet make an all-in, and vs 3bet AI must call
##list3## includes hands that must be opened, vs 3bet must call, and vs 3bet AI must fold
##list3## includes hands that must be opened, vs 3bet must fold, and vs 3bet AI must fold
Alex
Site Admin
Site Admin
Posts: 3112
Joined: Sun Mar 26, 2017 5:58 pm

Re: Coding preflop

Post by Alex »

No, it is far from correct. If you try to run such code you will instantly see a lot of errors.
You can't make more than 1 open-ended WHEN condition (https://documentation.help/OpenPPL/Stru ... _File.html)
lists are used without ## in the body of code.
There is no ELSE command in OpenPPL.
Again, as i said, studying 1-2 typical PPL profiles will make those things very clear
CoffeeShark
Fish
Fish
Posts: 9
Joined: Tue May 30, 2023 11:15 am

Re: Coding preflop

Post by CoffeeShark »

Got it!
I made a couple of rookie mistakes that I had already corrected, sorry!
After that my code was like this:

Code: Select all

WHEN nplayersseated = 3 AND InButton AND list1 AND (EffectiveMaxStacksizeOfActiveOpponents >= 30) RaiseMax FORCE
WHEN nplayersseated = 3 AND InButton AND list2 AND (EffectiveMaxStacksizeOfActiveOpponents >= 20 AND EffectiveMaxStacksizeOfActiveOpponents < 30) RaiseMax FORCE
WHEN nplayersseated = 3 AND InButton AND list3 AND (EffectiveMaxStacksizeOfActiveOpponents >= 10 AND EffectiveMaxStacksizeOfActiveOpponents < 20) RaiseMax FORCE
Now it seems correct to me. When using the profile in WB it doesn't give me any errors, but ingame I notice that it doesn't respect the ranks.

On the other hand I still don't know how to solve sequences like this; hands that must be opened, vs 3bet make an all-in, and vs 3bet AI must call... maybe using 3 conditionals for the same list of hands?

thanks for the patience!
Alex
Site Admin
Site Admin
Posts: 3112
Joined: Sun Mar 26, 2017 5:58 pm

Re: Coding preflop

Post by Alex »

CoffeeShark wrote: Sat Jun 10, 2023 8:54 pm Got it!
I made a couple of rookie mistakes that I had already corrected, sorry!
After that my code was like this:

Code: Select all

WHEN nplayersseated = 3 AND InButton AND list1 AND (EffectiveMaxStacksizeOfActiveOpponents >= 30) RaiseMax FORCE
WHEN nplayersseated = 3 AND InButton AND list2 AND (EffectiveMaxStacksizeOfActiveOpponents >= 20 AND EffectiveMaxStacksizeOfActiveOpponents < 30) RaiseMax FORCE
WHEN nplayersseated = 3 AND InButton AND list3 AND (EffectiveMaxStacksizeOfActiveOpponents >= 10 AND EffectiveMaxStacksizeOfActiveOpponents < 20) RaiseMax FORCE
Now it seems correct to me. When using the profile in WB it doesn't give me any errors, but ingame I notice that it doesn't respect the ranks.

On the other hand I still don't know how to solve sequences like this; hands that must be opened, vs 3bet make an all-in, and vs 3bet AI must call... maybe using 3 conditionals for the same list of hands?

thanks for the patience!
i am attaching so-called "CommunityDrivenBot", this is not working profile, but it is a template for creating new ones.
It's valuable, because it's well-structured and you can learn by exploring its code
Attachments
CommunityDrivenBot.zip
(5.86 KiB) Downloaded 171 times
CoffeeShark
Fish
Fish
Posts: 9
Joined: Tue May 30, 2023 11:15 am

Re: Coding preflop

Post by CoffeeShark »

Thanks Alex, I'm going to study the code of the profile!
Post Reply