BBO Discussion Forums: Using the Deal 3.19 to do hand analysis - BBO Discussion Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Using the Deal 3.19 to do hand analysis

#1 User is offline   Cthulhu D 

  • PipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 1,169
  • Joined: 2011-November-21
  • Gender:Not Telling
  • Location:Australia
  • Interests:Overbidding

Posted 2014-October-27, 04:12

So this thread has a simple enough problem: http://www.bridgebas...039#entry817039

If north opens 1S, and south bids 3C, what % of the time am I making one of (north declares) 3NT or (south declares) 4H or 5C - anyone know how to actually DO this? I've deduced I can use the ddline output to get results formatted like so:

AKQ93..QJT53.A96|754.KQ764.AK964.|2.AJT32.2.QJT832|JT86.985.87.K754|9 7 9 11 9|4 5 4 1 4|8 7 8 11 9|4 5 4 1 4

but obviously I only care about the North and South results.

I've consulted the documentation, but I don't understand the usage of deal::tricks - how do I capture that analysis as output?

I really just want to know, 50% of hands that meet my criteria make game, and 50% don't or whatever it is.

My workaround is to edit ddline format to create a customish format, then importing that into a spreadsheet for manual analysis,
0

#2 User is offline   Siegmund 

  • Alchemist
  • PipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 1,764
  • Joined: 2004-June-15
  • Gender:Male
  • Location:Beside a little lake in northwestern Montana
  • Interests:Creator of the 'grbbridge' LaTeX typesetting package.

Posted 2014-October-27, 20:55

How complicated of a method you use, depends how much TCL you feel like learning, vs. importing into another system.

If I am going to use an outside program for analysis, I usually customize the output format rather than using ddline (and it saves time, to not do all 20 analyses if you dont care about all 20 of them.)
You can edit the format definitions, but I usually use source format/none to suppress the automatic output and then write one PUTS statement inside your main loop to (for instance) create a .csv file that has data on each generated hand in a format that is easy to import into a spreadsheet.


For simple questions like what percentage of the time a contract makes, you can do that inside your deal script. If you use Thomas's 'sdev' structure, you define statistics accumulators in the preamble, you submit data to them in the main loop, and you view the results afterward:

source format/none #if you dont want to see a thousand hands spewed on the screen

sdev avgtricks
sdev chanceofmaking

main {

# put your restrictions on hands here

set t [deal::tricks south notrump]
avgtricks add $t
if {$t>=9} {chanceofmaking add 1} {chanceofmaking add 0}

accept
}

deal_finished {
puts "Average tricks: [avgtricks average]"
puts "Probability of making game: [chanceofmaking average]"
}
1

#3 User is offline   Cthulhu D 

  • PipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 1,169
  • Joined: 2011-November-21
  • Gender:Not Telling
  • Location:Australia
  • Interests:Overbidding

Posted 2014-October-27, 21:31

That is very helpful, thank you. That does exactly what I want.

Can you do something similar for lead analysis?

Quote

If I am going to use an outside program for analysis, I usually customize the output format rather than using ddline (and it saves time, to not do all 20 analyses if you dont care about all 20 of them.)
You can edit the format definitions, but I usually use source format/none to suppress the automatic output and then write one PUTS statement inside your main loop to (for instance) create a .csv file that has data on each generated hand in a format that is easy to import into a spreadsheet.


Yeah, I had just modified DDline to output in a CSV format I could easily import into openoffice. But the answer to the other question is invaluable.
0

#4 User is offline   Siegmund 

  • Alchemist
  • PipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 1,764
  • Joined: 2004-June-15
  • Gender:Male
  • Location:Beside a little lake in northwestern Montana
  • Interests:Creator of the 'grbbridge' LaTeX typesetting package.

Posted 2014-October-28, 09:31

To test different leads you can have a series of calls to the solver like

set t [deal::tricks south notrump]
set t_after_as_led [dds -reuse -leader west -trick as south notrump]
set t_after_2s_led [dds -reuse -leader west -trick 2s south notrump]
set t_after_7c_led [dds -reuse -leader west -trick 7c south notrump]
set t_after_2c_led [dds -reuse -leader west -trick 2c south notrump]
...

and then count how many times $t == $t_after_as_led, etc, to find out how often leading the A blows a trick.

I have a script to automatically find all possible leads and test them, but it is a little opaque, and requires a couple of custom libraries to help me count all the things I want to count.
0

#5 User is offline   antonylee 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 499
  • Joined: 2011-January-19
  • Gender:Male

Posted 2014-October-29, 13:56

Time to advertise redeal :)

Not sure what sim conditions you want, here I set the South hand and constrain the North hand to a 1S opening.

$ python -mredeal -S'2 AJT32 2 QJT832' --init 'global T; T = {"3NN": 0, "4HS": 0, "5CS": 0}' --accept 'return max(deal.north.shape) == len(deal.north.spades) >= 5 and 12 <= deal.north.hcp <= 20' \
                  --do 'for k in T: T[k] += deal.dd_score(k) > 0' --final 'print(T)' -n1000
{'4HS': 478, '3NN': 224, '5CS': 407}


For opening lead analysis, there is a "deal.dd_all_tricks(strain, leader)" (well, perhaps I should change it to "deal.dd_all_tricks(contract)") which returns a mapping of the number of DD tricks for each lead; you can easily extract the information from there.
0

#6 User is offline   Cthulhu D 

  • PipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 1,169
  • Joined: 2011-November-21
  • Gender:Not Telling
  • Location:Australia
  • Interests:Overbidding

Posted 2014-October-29, 16:32

You got a link? Google doesn't turn up anything.

Edit: or is this it? https://github.com/anntzer/redeal
0

#7 User is offline   antonylee 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 499
  • Joined: 2011-January-19
  • Gender:Male

Posted 2014-October-29, 16:44

Yes.
Feedback would be very appreciated!
0

#8 User is offline   tony stack 

  • PipPip
  • Group: Members
  • Posts: 25
  • Joined: 2004-January-26

Posted 2017-October-04, 12:10

View Postantonylee, on 2014-October-29, 13:56, said:

Time to advertise redeal :)

Not sure what sim conditions you want, here I set the South hand and constrain the North hand to a 1S opening.

$ python -mredeal -S'2 AJT32 2 QJT832' --init 'global T; T = {"3NN": 0, "4HS": 0, "5CS": 0}' --accept 'return max(deal.north.shape) == len(deal.north.spades) >= 5 and 12 <= deal.north.hcp <= 20' \
                  --do 'for k in T: T[k] += deal.dd_score(k) > 0' --final 'print(T)' -n1000
{'4HS': 478, '3NN': 224, '5CS': 407}


For opening lead analysis, there is a "deal.dd_all_tricks(strain, leader)" (well, perhaps I should change it to "deal.dd_all_tricks(contract)") which returns a mapping of the number of DD tricks for each lead; you can easily extract the information from there.


Wondering how to install this program on Mac? I had the older deal 3.1.7 on dos run just fine
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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