BBO Discussion Forums: action average not working - BBO Discussion Forums

Page 1 of 1

action average not working Dealer script

#1pescetom

• Posts: 3,954
• Joined: 2014-February-18
• Gender:Male
• Location:Italy

Posted 2020-October-25, 10:32

Can anyone please spot why the following draft script gives 'Can't open temporary file' unless I comment out the 'action average' line?
What causes that error message in general?
Thanks.

Dealer script:
```#
# 1NT vs 1M opening comparison
#
nt1517= hcp(north)>=15 and hcp(north)<=17
invite= hcp(south)>=8 and hcp(south)<=9
thingame= hcp(south)>=10 and hcp(south)<=10
safegame= hcp(south)>=11 and hcp(south)<=12
resp5332= shape(south, any 5332)
s5 = spades(north)==5 and shape(north, any 5332)
produce 20
action average "Avg. tricks if N plays in spades" (tricks(north,spades)), average "Avg. tricks if N plays in notrump" (tricks(north,notrump))
condition nt1517 and s5 and invite and resp5332
```

0

#2hrothgar

• Posts: 14,938
• Joined: 2003-February-13
• Gender:Male
• Location:Natick, MA
• Interests:Travel
Cooking
Brewing
Hiking

Posted 2020-October-25, 11:42

move the condition above the action average statements

Dealer ignores whitespace and right now the silly thing believes that condition is part of the second average statement
Alderaan delenda est
0

#3nullve

• Posts: 1,561
• Joined: 2014-April-08
• Gender:Male
• Location:Norway
• Interests:partscores

Posted 2020-October-25, 11:44

Make sure you use

http://dealergib1.br...aler/dealer.php,

mentioned by uday here, and not

https://www.bridgeba...aler/dealer.php
.

.
0

#4pescetom

• Posts: 3,954
• Joined: 2014-February-18
• Gender:Male
• Location:Italy

Posted 2020-October-25, 12:06

hrothgar, on 2020-October-25, 11:42, said:

move the condition above the action average statements

Dealer ignores whitespace and right now the silly thing believes that condition is part of the second average statement

Thanks.
nullve, that might be an issue with your 'Close Decision' script too (I tried moving the condition and got 10.29 for E in clubs).
0

#5pescetom

• Posts: 3,954
• Joined: 2014-February-18
• Gender:Male
• Location:Italy

Posted 2020-October-25, 12:10

nullve, on 2020-October-25, 11:44, said:

Thanks, that was the 'temp file' problem.
Maybe BBO could link the new page into the client (or at least a sticky topic in this forum) so it can be found more easily.
0

#6nullve

• Posts: 1,561
• Joined: 2014-April-08
• Gender:Male
• Location:Norway
• Interests:partscores

Posted 2020-October-25, 12:28

pescetom, on 2020-October-25, 12:06, said:

nullve, that might be an issue with your 'Close Decision' script too (I tried moving the condition and got 10.29 for E in clubs).

Moving the condition doesn't seem to make much difference when I do it, but maybe it should.
0

#7pescetom

• Posts: 3,954
• Joined: 2014-February-18
• Gender:Male
• Location:Italy

Posted 2020-October-26, 09:16

If I may trouble you with some further teething problems..

I can't get 'printes' to work, even pasting in the example from the Input File:
action printes "Number of hearts: ", hearts(north), \n
gives 'syntax error'.

I needed this to debug an attempt at using 'score', which also gives syntax error in the line below, perhaps just because I have not found a valid value for the 'vulnerability' parameter (I tried using keywords none or EW, plus the expression vulnerable(none)):
action frequency "Freq 2s scores:" (score(none,"x2s",tricks(north,spades)),-300,170)
gives 'syntax error'.
0

#8nullve

• Posts: 1,561
• Joined: 2014-April-08
• Gender:Male
• Location:Norway
• Interests:partscores

Posted 2020-October-26, 10:13

pescetom, on 2020-October-26, 09:16, said:

I can't get 'printes' to work, even pasting in the example from the Input File:
action printes "Number of hearts: ", hearts(north), \n
gives 'syntax error'.

```action printes ("Number of hearts: ", hearts(north),\n)
```

seems to work.
0

#9pescetom

• Posts: 3,954
• Joined: 2014-February-18
• Gender:Male
• Location:Italy

Posted 2020-October-26, 11:07

nullve, on 2020-October-26, 10:13, said:

```action printes ("Number of hearts: ", hearts(north),\n)
```

seems to work.

Thanks, it does.

And yet:
```action printes ("Score 2s 8 tricks: ", score(none,"x2S",8), \n)
```

still gives 'syntax error'.
Maybe there is an example of 'score' somewhere.
0

#10nullve

• Posts: 1,561
• Joined: 2014-April-08
• Gender:Male
• Location:Norway
• Interests:partscores

Posted 2020-October-26, 11:39

pescetom, on 2020-October-26, 09:16, said:

I needed this to debug an attempt at using 'score', which also gives syntax error in the line below, perhaps just because I have not found a valid value for the 'vulnerability' parameter (I tried using keywords none or EW, plus the expression vulnerable(none)):
action frequency "Freq 2s scores:" (score(none,"x2s",tricks(north,spades)),-300,170)
gives 'syntax error'.

The manual said:

vulnerable ({none|NS|EW|all})
Sets the vulnerability for the hand to 1 of the 4 possibilities, with none the default if the command is not in the input file.
This command is primarily intended for cases where action-list includes the printpbn action and the hands will be fed into another program for further analysis. These programs often require that the dealer and vulnerability are known. This command allows the user to set the vulnerability, the next command allows him to set the dealer.

[...]

score(vulnerability, contract, tricks)
Returns the positive or negative score that declarer will make if the given contract, at the given vulnerability condition, is played and the given number of tricks are made. The syntax for "contract" is of the form "x3N" for 3 no-trumps, "x7C" for 7 clubs, etc; the leading "x" is needed. There is currently no way to specify that the contract is doubled, nor that it is re-doubled. The result will be positive if the contract makes, negative if it goes down.

I don't know how to make the 'score' operator work, either, but my guess is that the 'vulnerability' argument does not have everything to do with the 'vulnerable' operator. (For example, if 'vulnerable' is set to 'EW', then the contract is vulnerable iff played by EW.)
0

#11pescetom

• Posts: 3,954
• Joined: 2014-February-18
• Gender:Male
• Location:Italy

Posted 2020-October-26, 11:59

nullve, on 2020-October-26, 11:39, said:

I don't know how to make the 'score' operator work, either, but my guess is that the 'vulnerability' argument does not have everything to do with the 'vulnerable' operator. (For example, if 'vulnerable' is set to 'EW', then the contract is vulnerable iff played by EW.)

I tried setting 'vulnerability' to NS at the top of the script and that worked, but did not help when parsing 'score'.
As first argument to score I tried none, "none", NS, 0, blank etc.
I also tried omitting the first argument altogether.
I think it knows it is parsing the function score, if I change the name I get 'unknown variable'.

Surely such a precious function will have been used by someone (or at least be known to be broken)?
0

#12nullve

• Posts: 1,561
• Joined: 2014-April-08
• Gender:Male
• Location:Norway
• Interests:partscores

Posted 2020-October-26, 15:35

Script:

```produce 1
action printes (score(vul,x7C,13),\n)
```

Run:

```2140
Generated 1 hands
Produced 1 hands
Initial random seed 1603746614
Time needed    0.000 sec
```

So the first argument is 'vul' if the contract is vulnerable.

Haven't figured out what it is when the contract is not vulnerable.
0

#13pescetom

• Posts: 3,954
• Joined: 2014-February-18
• Gender:Male
• Location:Italy

Posted 2020-October-26, 16:18

nullve, on 2020-October-26, 15:35, said:

So the first argument is 'vul' if the contract is vulnerable.

Haven't figured out what it is when the contract is not vulnerable.

Found that too, 'nv'.
Thanks again.
These guys sure know how to be consistent and document well
0