calculate/multiply memory symbols

Coding-related discussion: OpenPPL (Poker Programming Language) and internal OpenHoldem-script
Post Reply
rudeone
First blood
First blood
Posts: 19
Joined: Thu Apr 04, 2019 11:09 am

calculate/multiply memory symbols

Post by rudeone » Sun Apr 14, 2019 1:37 pm

this doesnt seem to work

Code: Select all

##f$myFunction##
	When true Return (me_re_myValue1 / 5 ) * me_re_myValue2 Force
is it possible tho?

also: is "When true" fine or does it make a difference to "When Others"

rem54
Botter for life
Botter for life
Posts: 555
Joined: Fri Apr 27, 2018 5:19 am

Re: calculate/multiply memory symbols

Post by rem54 » Sun Apr 14, 2019 1:53 pm

Try this

Code: Select all

##f$myFunction##
(me_re_myValue1 / 5 ) * me_re_myValue2 
Have you verified they are being set properly and returning the correct value in the debug page?

RandomName
Flush Royal
Flush Royal
Posts: 254
Joined: Fri Dec 21, 2018 5:01 pm

Re: calculate/multiply memory symbols

Post by RandomName » Sun Apr 14, 2019 2:02 pm

The way I would write that is:

Code: Select all

##f$myFunction##
	(me_re_myValue1 / 5 ) * me_re_myValue2
If your function doesn't get too complicated, you can build in "when"s as follows.

Suppose I want a function to return 1 if the amount to call is less than half my stack, otherwise return 3

Code: Select all

##f$blindcode##
     1 + 2 * (AmountToCall >= 50% StackSize)
ETA: rem54 keeps posting answers before I finish my post :)

rem54
Botter for life
Botter for life
Posts: 555
Joined: Fri Apr 27, 2018 5:19 am

Re: calculate/multiply memory symbols

Post by rem54 » Sun Apr 14, 2019 2:09 pm

Code: Select all

##f$CallSize##
WHEN AmountToCall < 50% StackSize Return 1 FORCE
WHEN Others Return 3 FORCE
I would post faster but the delay enforcement slows me down. :twisted:

It can be done either way.

rudeone
First blood
First blood
Posts: 19
Joined: Thu Apr 04, 2019 11:09 am

Re: calculate/multiply memory symbols

Post by rudeone » Sun Apr 14, 2019 2:19 pm

rem54 wrote:
Sun Apr 14, 2019 1:53 pm
Try this

Code: Select all

##f$myFunction##
(me_re_myValue1 / 5 ) * me_re_myValue2 
Have you verified they are being set properly and returning the correct value in the debug page?
ok nvm, i must have made some mistakes when i didnt fully understand how values get refreshed. it works :roll:

thx

rudeone
First blood
First blood
Posts: 19
Joined: Thu Apr 04, 2019 11:09 am

Re: calculate/multiply memory symbols

Post by rudeone » Sun Apr 14, 2019 2:58 pm

whats a good way to log memory symbols?
for example, i want to add the script version number in a mem symbol.

they only get logged when i read them?

how would i do:

Code: Select all

When me_re_myvariable CONTINUE (do nothing)

Alex
Site Admin
Site Admin
Posts: 1845
Joined: Sun Mar 26, 2017 5:58 pm

Re: calculate/multiply memory symbols

Post by Alex » Sun Apr 14, 2019 4:55 pm

rudeone wrote:
Sun Apr 14, 2019 2:58 pm
whats a good way to log memory symbols?
for example, i want to add the script version number in a mem symbol.

they only get logged when i read them?

how would i do:

Code: Select all

When me_re_myvariable CONTINUE (do nothing)
you can try this:

Code: Select all

WHEN Others and log$Version1 SET userDummy
so log will look like:

Code: Select all

f$preflop = 8.000 [Line 4491/4715]
  Others = 1.000 [Line 1/75]
    AlwaysTrue = 1.000 [Line 1/78]
      true = 1.000
  log$Version1 = 1.000
it works if you just want to set markers in log file (you will also see log marks in the bot window, which helps to understand what scenario the bot is playing)

Example from UltraGTO:

Code: Select all

WHEN f$4betPot and (BotsLastPreflopAction==Call) and BotsActionsOnThisRound<1 and Opponents==1 and log$4betPotCaller

RandomName
Flush Royal
Flush Royal
Posts: 254
Joined: Fri Dec 21, 2018 5:01 pm

Re: calculate/multiply memory symbols

Post by RandomName » Sun Apr 14, 2019 8:29 pm

rem54 wrote:
Sun Apr 14, 2019 2:09 pm

Code: Select all

##f$CallSize##
WHEN AmountToCall < 50% StackSize Return 1 FORCE
WHEN Others Return 3 FORCE
I would post faster but the delay enforcement slows me down. :twisted:

It can be done either way.
There are things I like about each approach. For the scenario I gave, rem54's code works better since it's easier to follow.
But there are definitely cases where I may have a default value that I want to add to or subtract from, so the example I gave makes more sense to me in that case -- you can see the default value and then what conditions cause you to add or subtract from it.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests