Cthulhu D Posted October 27, 2014 Report Share Posted October 27, 2014 So this thread has a simple enough problem: http://www.bridgebase.com/forums/topic/68382-do-you-have-any-chance/page__pid__817039#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, Quote Link to comment Share on other sites More sharing options...
Siegmund Posted October 28, 2014 Report Share Posted October 28, 2014 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 avgtrickssdev 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 Quote Link to comment Share on other sites More sharing options...
Cthulhu D Posted October 28, 2014 Author Report Share Posted October 28, 2014 That is very helpful, thank you. That does exactly what I want. Can you do something similar for lead analysis? 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. Quote Link to comment Share on other sites More sharing options...
Siegmund Posted October 28, 2014 Report Share Posted October 28, 2014 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. Quote Link to comment Share on other sites More sharing options...
antonylee Posted October 29, 2014 Report Share Posted October 29, 2014 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. Quote Link to comment Share on other sites More sharing options...
Cthulhu D Posted October 29, 2014 Author Report Share Posted October 29, 2014 You got a link? Google doesn't turn up anything. Edit: or is this it? https://github.com/anntzer/redeal Quote Link to comment Share on other sites More sharing options...
antonylee Posted October 29, 2014 Report Share Posted October 29, 2014 Yes.Feedback would be very appreciated! Quote Link to comment Share on other sites More sharing options...
tony stack Posted October 4, 2017 Report Share Posted October 4, 2017 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.