BBO Discussion Forums: Simulation software - BBO Discussion Forums

Jump to content

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

Simulation software

#1 User is offline   hautbois 

  • PipPipPip
  • Group: Full Members
  • Posts: 74
  • Joined: 2005-November-01
  • Gender:Male
  • Location:Maryland, USA

Posted 2013-July-22, 09:23

What software do you use to set up and run simulations? What tools are available to data mine the hands played by 4 humans on BBO?
0

#2 User is offline   mikeh 

  • PipPipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 13,045
  • Joined: 2005-June-15
  • Gender:Male
  • Location:Canada
  • Interests:Bridge, golf, wine (red), cooking, reading eclectically but insatiably, travelling, making bad posts.

Posted 2013-July-22, 10:08

View Posthautbois, on 2013-July-22, 09:23, said:

What software do you use to set up and run simulations? What tools are available to data mine the hands played by 4 humans on BBO?

DealMaster Pro

I bought my version (2.2) in about 2001 and last year my new computer wouldn't run it: the old version wouldn't run on Windows 7.

I emailed them (dealmaster@dealmaster.com), asking if I could buy a new version. They sent me a patch, free of charge, and it now runs fine.

They seem like good people (which is something that deserves reward) and the product is excellent. In fairness, I have never tried any competitor's product, but I am very happy with DM, and very impressed by their rejecting my offer to buy a new copy and, instead, give me a free upgrade 11 years after I bought the product.

It reminded me of a situation I had with Bryston, who manufactured the amp and pre-amp I had in my first audiophile quality stereo system. It had a 5 year warranty and the power supply in the amp failed after 6 years. The local dealer told me that all I have to do was pay the freight one way to the Bryston factory. I did so. Two weeks later, back came the unit with the problem fixed, the return freight paid by Bryston, no charge for the repairs and a new 25 year (!!!!) warranty. My stepson now has the units, that continue to work well despite being 35 years old (and off warranty, alas)

When you find businesses that treat clients this way, you can't help but want to tell others about them, and DM is one of those businesses.
'one of the great markers of the advance of human kindness is the howls you will hear from the Men of God' Johann Hari
1

#3 User is offline   akhare 

  • PipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 1,261
  • Joined: 2005-September-04
  • Gender:Male

Posted 2013-July-22, 16:09

The Python port of Thomas Andrew's Deal (search the forum) is good for simulations (the original is an excellent tool as well if TCL tickles you :D).

You can find the original dealer.exe in the wayback archives if you prefer the more sparse syntax and don't need to do much scripting.

For DD analysis of hand records and other interesting statistics, try DDS:

http://www.bridge-ca...m/DDS_Setup.exe
foobar on BBO
0

#4 User is offline   FM75 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 496
  • Joined: 2009-December-12

Posted 2013-July-22, 17:05

If you want software suggestions:
1) What platform do you use - Windows, Mac, Linux, web only?
2) Are you capable of building an executable program from open-source? (if you don't even know what that means, the answer is "no")

As to the question of data mining BBO, if it is worth any money to you, send me a private message, please. I have a number of ideas on that topic.

mikeh - nice testimonial! I don't use windows anymore. But my partner does like Deal Master Pro.
0

#5 User is offline   inquiry 

  • PipPipPipPipPipPipPipPipPipPip
  • Group: Admin
  • Posts: 14,566
  • Joined: 2003-February-13
  • Gender:Male
  • Location:Amelia Island, FL
  • Interests:Bridge, what else?

Posted 2013-July-22, 19:22

I use DealMaster Pro as well. Can't imagine trying anything else. It is easy to use (after a short learning curve). It also serves as a nice "database" for saving and retrieving interesting hands/.

The current best tool for datamining bbo played hands is Double Dummy solver from Bridge Captain. You can download hands for anyone you know their aliases. IT allows you download current month, last month, 24 hours, or 7 Days. It is sort of "stupid" (which is good), because it trust the date your computer says it is. So if you wanted two months ago, you can change the date of your computer (back two months and do "this month" or back one month and do "last month"). If you use that trick, remember to change your date back. :) My hands often doesn't have more than two or three months of data.

There is a program named Bridgebrowser that has over 300 or 400 million BBO hands, but none from most recent years. Rumor has it that Stephen Pickett is thinking of releasing the program for free with access to all the data. This is the program that Larry Cohen used for his million deal articles in the Sunshine state bridge bullentin. You can read those articles at


http://district9acbl...3_03/page14.htm

http://district9acbl...3_05/page12.htm

http://district9acbl...3_07/page12.htm

In fact, the entire content of the District 9 (Florida) bullentin are available online at the home address of those articles.
--Ben--

#6 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 2013-July-22, 20:38

I use the original TCL version of the Andrews dealer, for simulations.

To harvest my own BBO hand records I use the downloader built in to Bridge Captain, then feed the resulting huge PBN file to my own scripts, to go through bid-by-bid and card-by-card to see how much each error costs.
0

#7 User is offline   blackshoe 

  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 17,699
  • Joined: 2006-April-17
  • Gender:Male
  • Location:Rochester, NY

Posted 2013-July-23, 07:06

I bought a Windows laptop years ago when I started directing, because ACBLScore is a DOS program - although it has a Windows front end now. There are a couple of other Windows only programs I like - and DM Pro is one of them. So I still have the laptop, and occasionally I drag it out and fire it up. Frankly, though, if there were Mac versions of these things, I'd have everything on the Mac, except for directing purposes (need a laptop, have one, don't see a need to buy a Mac laptop just for that). Windows XP (I doubt the darn thing would even run Windows 7 or 8).

I've toyed with sticking things in Wine bottles on the Mac, and I "test drove" Crossover, a commercial version of Wine, a while ago, so I get periodic "buy me" emails from them, but I'm pretty lazy, so I've not actually done it.

ACBLSCore+, currently in the works, is supposedly going to run on Macs. I may get a Macbook Air or Macbook Pro then.
--------------------
As for tv, screw it. You aren't missing anything. -- Ken Berg
I have come to realise it is futile to expect or hope a regular club game will be run in accordance with the laws. -- Jillybean
0

#8 User is offline   hautbois 

  • PipPipPip
  • Group: Full Members
  • Posts: 74
  • Joined: 2005-November-01
  • Gender:Male
  • Location:Maryland, USA

Posted 2013-August-05, 17:49

First, I'd like to thank for the multiple recommendations. I've decided to try Thomas Andrews' Deal because it was recommended and as an excuse to learn a new programming language.

(Note: I have a BS in CS yet I have not previously used TCL before this weekend, but have used more programming languages than I care to enumerate here.)

Deal's documentation doesn't cover the use case I'm most interested in. I'm wondering if there's a more elegant way to go about what I'm trying to do. If these problems are better addressed by the Python port, I'll be just as happy to use that.

It seems I should provide an implementation of the main function to restrict the deals I'm interested in and make a write_deal proc to format the output.

To borrow an example from another thread, say I want to examine how often a 20-22 HCP 8-card fit produces a better result in 2M than 2NT. I could put the hand analysis in the main function before accept conditions.

main {
    if { [spades north] + [spades south] == 8
         && [hcp north] + [hcp south] >= 20
         && [hcp north] + [hcp south] <= 22 } {

        puts "notrump: [tricks south notrump] spades: [tricks south spades]"
        accept
    }
}


This offends everything I know about coding style.

I could also put this in the write_deal function.

main {
    if { [spades north] + [spades south] == 8
         && [hcp north] + [hcp south] >= 20
         && [hcp north] + [hcp south] <= 22 } {
        accept
    }
}

proc write_deal {} {
    puts "notrump: [tricks south notrump] spades: [tricks south spades]"
}


But now I've lost the nice default formatting. Is there another location to put hand analysis or a way to call the previous write_deal function I've overridden?

Further, I want the code to keep a running tally across many deals. Are there functions deal calls before its multiple calls to main and write_deal where I can put variables for statistics?

e.g., is there a cleaner way to accomplish this?

set nt_total 0
set sp_total 0

main {
    if { [spades north] + [spades south] == 8
         && [hcp north] + [hcp south] >= 20
         && [hcp north] + [hcp south] <= 22 } {
        accept
    }
}

proc write_deal {} {
    set nt [tricks south notrump]
    set sp [tricks south spades]
    global nt_total
    global sp_total
    set nt_total [expr {$nt_total + $nt}]
    set sp_total [expr {$sp_total + $sp}]
    puts "notrump: $nt spades: $sp" ;

    # I'd rather call this only once after all deals have been generated        
    puts "total notrump: $nt_total total spades: $sp_total"
}

0

#9 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 2013-August-05, 20:33

Quote

It seems I should provide an implementation of the main function to restrict the deals I'm interested in and make a write_deal proc to format the output.


So far so good.

Quote

I could put the hand analysis in the main function before accept conditions....This offends everything I know about coding style.


People often do it that way. :)

Quote

I could also put this in the write_deal function....But now I've lost the nice default formatting. Is there another location to put hand analysis or a way to call the previous write_deal function I've overridden?


Several output formats (i.e., different definitions of the write_deal function) are provided in the 'format' folder. format/default is the standard one. format/ddline and format/none are also frequently used.

If you define your own output format you really like, you can save it as a new custom format, and then put "source format/mynewformatfile" in the preamble of your program, rather than having write_deal in every sim script you write.

Quote

Further, I want the code to keep a running tally across many deals. Are there functions deal calls before its multiple calls to main and write_deal where I can put variables for statistics?


Yes. Andrews provides a command "sdev" to facilitate statistics. It is in his documentation. Your example would look like this:

sdev nttricks
sdev sptricks

main {
    if { [spades north] + [spades south] == 8
 		&& [hcp north] + [hcp south] >= 20
 		&& [hcp north] + [hcp south] <= 22 } {
# You can probably put all this in write_deal instead but I've never tried it that way
 set nt [tricks south notrump]
    set sp [tricks south spades]
nttricks add $nt
sptricks add $sp
        accept
    }
}

#To only call the total once you use deal_finished;
deal_finished {
puts "Avg. tricks in spades: [sptricks average]"
puts "Avg. tricks in notrump: [nttricks average]"
}


I also frequently build into my simulations a more detailed analysis of each hand than just counting total tricks.

For instance, if your question is, specifically, does 2S score better than 2NT at matchpoints, you might put "sdev mpresult" in the preamble, and then, in your processing loop,
 set nt [tricks south notrump]
    set sp [tricks south spades]
if {$sp>$nt} {mpresult add 100} { 
  	if {$sp == $nt && $sp<8} {mpresult add 50} {mpresult add 0} }

Now "puts [mpresult average]" in deal_finished will tell you how often a 2S bidder will beat a 2NT bidder at matchpoints. (Or, you can count wins losses and ties individually in three separate variables, etc.)

[mpresult count] and [mpresult sdev] give the sample size and the standard deviation of whatever data you've fed into mpresult with the add command too. (Yes, "sdev blah" to define variable blah and "blah sdev" to get back the standard deviation at the end is confusing. But no stranger than "spades south" and "south spades" meaning two different things (one returns a list of cards, one a count.)

I can share some examples of deal analysis scripts I have used in the past. Fair warning, my programming style guaranteed to offend anyone who went to a CS department.
0

#10 User is offline   antonylee 

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

Posted 2013-August-05, 20:58

Here it is with Redeal (https://github.com/anntzer/redeal).
$ python -mredeal --init 'self.nt_total = self.sp_total = 0' --accept 'return len(deal.north.spades) + len(deal.south.spades) == 8 and 20 <= deal.north.hcp + deal.south.hcp <= 22' \
--do 'nt = deal.dd_tricks("1NS"); sp = deal.dd_tricks("1SS"); print(deal, nt, sp); self.nt_total += nt; self.sp_total += sp' --final 'print(self.nt_total, self.sp_total)'
♠JT32♡KJ943♢♣K852 ♠94♡2♢KJ96543♣AT4 ♠AK65♡Q876♢Q872♣Q ♠Q87♡AT5♢AT♣J9763 5 9
♠A953♡98532♢K9♣Q5 ♠K8♡KJ6♢T653♣KJT9 ♠QJT4♡AQT74♢A7♣83 ♠762♡♢QJ842♣A7642 8 8
♠KQ72♡93♢AJ98♣A96 ♠84♡AKJT8♢K7432♣4 ♠A953♡Q76♢65♣8752 ♠JT6♡542♢QT♣KQJT3 8 9
♠J653♡AQ654♢54♣KT ♠K7♡T73♢72♣AJ9654 ♠AT84♡♢KJT986♣Q83 ♠Q92♡KJ982♢AQ3♣72 6 8
♠9764♡AQ53♢T53♣T8 ♠JT52♡92♢KQ9♣KJ54 ♠AKQ8♡864♢AJ74♣63 ♠3♡KJT7♢862♣AQ972 7 8
♠A754♡A7♢J4♣AKJ84 ♠J98♡QJT8532♢T♣T5 ♠K632♡94♢985♣Q973 ♠QT♡K6♢AKQ7632♣62 6 9
♠Q954♡AT92♢875♣J8 ♠A863♡J63♢K9♣T653 ♠JT72♡Q♢AQT632♣KQ ♠K♡K8754♢J4♣A9742 8 9
♠974♡K862♢AQ954♣K ♠Q85♡JT9♢762♣AJ98 ♠KJT32♡A♢T3♣Q6542 ♠A6♡Q7543♢KJ8♣T73 9 11
♠K82♡73♢AJ432♣JT9 ♠J♡QJT92♢KT96♣K53 ♠97654♡AK54♢5♣AQ6 ♠AQT3♡86♢Q87♣8742 7 9
♠AKQ97♡8♢A865♣932 ♠J43♡J7543♢KJT7♣7 ♠T85♡AK962♢3♣QT84 ♠62♡QT♢Q942♣AKJ65 8 10
72 90


0

#11 User is offline   hautbois 

  • PipPipPip
  • Group: Full Members
  • Posts: 74
  • Joined: 2005-November-01
  • Gender:Male
  • Location:Maryland, USA

Posted 2013-August-05, 22:14

From Redeal's documentation

Quote

As one can see, there are in total, four functions that can be overriden:

initial (taking no argument) is called when the simulation begins (defaults to doing nothing)
accept (taking a deal argument) should return True or False depending on whether the deal is accepted -- defaults to always True,
do (taking a deal argument) is called on each accepted deal -- defaults to printing the deal,
final (taking a n_tries argument) is called when the simulation ends (defaults to printing the number of tries).


This simplifies things a lot plus python syntax is much more terse. This looks like a better solution to my tcl problems.
0

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

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