BBO Discussion Forums: Another syntax problem - BBO Discussion Forums

Jump to content

Page 1 of 1

Another syntax problem

#1 User is offline   rpls 

  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 2013-July-06

Posted 2019-October-09, 09:22

Hi
basically i want to generate hands that would open in one of a major; this implies opener cant have a longer minor suit

i have the code for opening 1 M:
(
spades(south)>=5 
and 
hcp(south)>=10 
and 
hcp(south)<=15 
)
||
(
hearts(south)>=5 
and 
hcp(south)>=10 
and 
hcp(south)<=15 
)

but i dont know how to code the restriction i mentioned above

Thanks in advance for your help
0

#2 User is offline   pescetom 

  • PipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 2,125
  • Joined: 2014-February-18
  • Gender:Male
  • Location:Italy

Posted 2019-October-09, 10:19

I imagine it would become:

(
spades(south)>=5 
and 
hcp(south)>=10 
and 
hcp(south)<=15 
and
clubs(south)<=spades(south)
and
diamonds(south)<=spades(south)
)
||
(
hearts(south)>=5 
and 
hcp(south)>=10 
and 
hcp(south)<=15 
and
clubs(south)<=spades(south)
and
diamonds(south)<=spades(south)
)



As an aside, do you really want to open any 5cM as 1M with 10 HCP and with 15 HCP? I would pass the first and open 1NT many of the second.
0

#3 User is offline   rpls 

  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 2013-July-06

Posted 2019-October-09, 10:47

View Postpescetom, on 2019-October-09, 10:19, said:

I imagine it would become:

(
spades(south)>=5 
and 
hcp(south)>=10 
and 
hcp(south)<=15 
and
clubs(south)<=spades(south)
and
diamonds(south)<=spades(south)
)
||
(
hearts(south)>=5 
and 
hcp(south)>=10 
and 
hcp(south)<=15 
and
clubs(south)<=spades(south)
and
diamonds(south)<=spades(south)
)



As an aside, do you really want to open any 5cM as 1M with 10 HCP and with 15 HCP? I would pass the first and open 1NT many of the second.

Hi
Thanks for answering

What i'm doing here is testing this precision style openings :)

As an aside, how can i code something like: i dont want a 4333 or 4432 or 5332 shape?
I'm trying
hcp(south)>=16
and
condition shape(south, ! (any 4333 + any 4423+ any 5332))

but it wont work

Regards
0

#4 User is offline   rpls 

  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 2013-July-06

Posted 2019-October-09, 11:02

in the meanwhile i got it:
condition shape(south, any xxxx - any 4333 - 4432 - 5332)
and 
hcp(south)>=16

0

#5 User is offline   nige1 

  • 5-level belongs to me
  • PipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 7,881
  • Joined: 2004-August-30
  • Gender:Male
  • Location:Glasgow Scotland
  • Interests:Poems Computers

Posted 2019-October-09, 12:07

# Unbalanced Precision one of a major openers - rpls 09 Oct 2019
sUnBal = not shape (south, any 4333 + any 4432 + any 5332)
sInRange = 9 < hcp (south) and hcp (south) < 16
sS = spades (south)
sH = hearts (south)
s1S = sS > 4 and sS >= sH and sS >= diamonds (south) and sS >= clubs (south)
s1H = sH > 4 and sH > sS and sH >= diamonds (south) and sH >= clubs (south)
condition sUnBal and sInRange and (s1H or s1S)
action printoneline
produce 5

0

#6 User is offline   rpls 

  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 2013-July-06

Posted 2019-October-09, 12:56

View Postnige1, on 2019-October-09, 12:07, said:

# Unbalanced Precision one of a major openers - rpls 09 Oct 2019
sUnBal = not shape (south, any 4333 + any 4432 + any 5332)
sInRange = 9 < hcp (south) and hcp (south) < 16
sS = spades (south)
sH = hearts (south)
s1S = sS > 4 and sS >= sH and sS >= diamonds (south) and sS >= clubs (south)
s1H = sH > 4 and sH > sS and sH >= diamonds (south) and sH >= clubs (south)
condition sUnBal and sInRange and (s1H or s1S)
action printoneline
produce 5


Great!

The code is very elegant: are you a pro?

I dont understand the last 2 lines, mostly the last one :(
0

#7 User is offline   nige1 

  • 5-level belongs to me
  • PipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 7,881
  • Joined: 2004-August-30
  • Gender:Male
  • Location:Glasgow Scotland
  • Interests:Poems Computers

Posted 2019-October-09, 13:28

View Postrpls, on 2019-October-09, 12:56, said:

Great! The code is very elegant: are you a pro? I dont understand the last 2 lines, mostly the last one :(

I started out as a programmer and always enjoy it.


read the Syntax guide
  • printoneline prints the 4 hands of a deal, compactly, on one line
  • produce 5 means print the first 5 deals that satisfy the condition, from those randomly generated (the default is 40 hands printed).



0

#8 User is offline   rpls 

  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 2013-July-06

Posted 2019-October-09, 13:59

View Postnige1, on 2019-October-09, 13:28, said:

I started out as a programmer and always enjoy it.


read the Syntax guide
  • printoneline prints the 4 hands of a deal, compactly, on one line
  • produce 5 means print the first 5 deals that satisfy the condition, from those randomly generated (the default is 40 hands printed).


I must confess i started reading the manual but that looks like "mandarin" for me :)

my goal is to be able to generate hands for training purposes

Thanks, nige1
0

Share this topic:


Page 1 of 1


Fast Reply

  

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users