BBO Discussion Forums: Are you writing a bridge simulation? - BBO Discussion Forums

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Are you writing a bridge simulation? How many BBO'rs do this?

#1 User is offline   Scarabin 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 382
  • Joined: 2010-December-30
  • Gender:Male
  • Interests:All types of games especially bridge & war games.
    old bidding systems & computer simulation programming.

Posted 2012-July-07, 04:03


I am intrigued by the number of BBO'rs who mention that they are writing bridge computer simulations or playing programs either as a hobby or commercially and I would like to learn who is involved and what you are working on.

To start things off, I am engaged on two programs, both of hobby rather than professional standard:

- an aid to counting in play, and

- a program to compare bidding systems and hand evaluation systems.

Hope to hear from you all. :rolleyes:
1

#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 2012-July-07, 09:42

Many of us who "write simulations" including myself, are writing scripts to feed to someone else's dealer and double dummy analyzer software. The front ends can be quite involved, doing things like taking a given defender's hand, dealing out 1000 hands consistent with a given auction, and trying every possible lead against each one (double-dummy play for the remaining 51 cards each time), to see which lead gives up a trick least often. My most elaborate such front end will take a set of BBO hand records, go through bid by bid and card by card, flag every move that costs vs. double-dummy par and vs. the state of the game before that bid or card, and create statistics on the frequency of such errors by each player.

I have dabbled in other bridge software in the past -- creating a timer application for use in bridge clubs, a LaTeX package for typesetting hands, and explored several computationally expensive approaches to developing a rating system.

The timer and the LaTeX package were of a quality to be suitable to give them away to others, though they were intended originally as tools for my local club and to make my own life easier as a teacher and director.
0

#3 User is offline   antonylee 

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

Posted 2012-July-08, 01:34

I'll jump on the opportunity to re-advertise my dealer program, Redeal (https://github.com/anntzer/redeal), which should be reasonably easy to use if 1/ you know Python, and 2/ you work on Linux/Mac or don't need the double-dummy solver. Mostly, my goal is to have an easy way to compare different bidding strategies (such as, holding 652K752539862 opposite a partner who has shown a 22-24NT, should you pass, bid 3N or bid Stayman? and does it matter whether you play regular or Puppet?)
1

#4 User is offline   FrancesHinden 

  • Limit bidder
  • PipPipPipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 8,482
  • Joined: 2004-November-02
  • Gender:Female
  • Location:England
  • Interests:Bridge, classical music, skiing... but I spend more time earning a living than doing any of those

Posted 2012-July-08, 10:00

Most people are using already-existing software to run simulations.
Like (I would guess) many others, I have written my own dealing/simulation programme, more or less just to prove that I could, but I actually use someone else's when I want to do a lot because it runs much faster than mine.
0

#5 User is offline   RossSCann 

  • PipPip
  • Group: Members
  • Posts: 25
  • Joined: 2012-July-06

Posted 2012-July-08, 12:50

View PostScarabin, on 2012-July-07, 04:03, said:


I am intrigued by the number of BBO'rs who mention that they are writing bridge computer simulations or playing programs either as a hobby or commercially and I would like to learn who is involved and what you are working on.

To start things off, I am engaged on two programs, both of hobby rather than professional standard:

- an aid to counting in play, and

- a program to compare bidding systems and hand evaluation systems.

Hope to hear from you all. :rolleyes:

I am writing a bidding question evaluation program to test alternate bidding decisions using a bridge teaching program that I offer for free trial on the net
at www.bridgegame.com This program is aimed at beginners primarily, but it's bidding and play is intermediate level.
I have an active thread going now in this forum over the accuracy of my program's results. My program version on the net doesn't have this simulation feature at this point.
My program works by entering the S cards and the bidding up to the point of the bids in question, which are always made by S. Two alternate bids are entered as the question in point. The program runs 500 random cases simulating each of the two bidding alternatives. The play is not double dummy because I don't need double duumy play for teaching. I am trying to find sources of results of similar analysis that I can test the results of my simulations against.
1

#6 User is offline   myfish 

  • PipPip
  • Group: Members
  • Posts: 46
  • Joined: 2004-March-26

Posted 2012-July-08, 20:31

Hi,
I want to ask is there any link for the existing bridge simulation program?
1

#7 User is offline   antonylee 

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

Posted 2012-July-08, 22:24

Thomas Andrews' Deal (http://bridge.thomasoandrews.com/deal/) is quite good.
2

#8 User is offline   Scarabin 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 382
  • Joined: 2010-December-30
  • Gender:Male
  • Interests:All types of games especially bridge & war games.
    old bidding systems & computer simulation programming.

Posted 2012-July-13, 00:43

Thanks for your responses.

In starting this Topic I had 3 thoughts:

1) It is always nice to know you are not entirely alone.

2) It would be interesting to discover a common thread in people who combine bridge and computer programming. I suspect they are usually also mathematicians, for starters?

3) If enough people respond it might be worthwhile to float the possibility of a joint endeavour to write a mammoth bridge playing program. I know there are other programmers out there who have still to respond.

What do you think?
1

#9 User is offline   bluecalm 

  • PipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 2,555
  • Joined: 2007-January-22

Posted 2012-July-13, 00:51

Quote

Like (I would guess) many others, I have written my own dealing/simulation programme, more or less just to prove that I could, but I actually use someone else's when I want to do a lot because it runs much faster than mine.


I am still to prove it to myself :)
One thing which is bothering me when it comes to dmpro (don't know about other software) is that it doesn't run in parallel on multiple cores. As the problem of calculating double dummy results for many hands should scale linearly that would be huge boost on modern processors (like 8x faster on i7). It would require just few line of code more (assuming the software is written in C or C++) but without the source I can't do anything about it.
Same goes for dealing software, although I admit I have no idea if for example deal runs on multiple cores.
I am involved in writing simulation software for other card game now but once I am done with it I think I am going to spend some time on my own simulator just to have it run on multi cores (and deal cards faster I think dealing programs are really bad when it comes to rare hands).

Quote

If enough people respond it might be worthwhile to float the possibility of a joint endeavour to write a mammoth bridge playing program.


Yeah, bridge playing program would be cool. It's high time to knock GIB out of BBO :)
What I would be very interested in for starters is a simulator which can solve defensive problems after several tricks are already played. It would require a lot of human input but could give valuable output about what play is the best at given stage. As far as I am aware there is no such software available but the concept is not that complicated.
0

#10 User is offline   Antrax 

  • PipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 2,458
  • Joined: 2011-March-15
  • Gender:Male

Posted 2012-July-13, 03:41

Well, I'm a software engineer, not mathematically inclined beyond what is common in this profession, and haven't chimed in until now as I'm not writing any Bridge software - what exists is quite enough for me. However, this:

View Postbluecalm, on 2012-July-13, 00:51, said:

One thing which is bothering me when it comes to dmpro (don't know about other software) is that it doesn't run in parallel on multiple cores.
is basically what I do, so if there's an interest in a community effort of some sort, I can help with optimization, single or multi threaded.
0

#11 User is offline   rhm 

  • PipPipPipPipPipPipPip
  • Group: Advanced Members
  • Posts: 3,090
  • Joined: 2005-June-27

Posted 2012-July-13, 03:51

How I understand the best modern Bridge Playing Software works is, that it samples possible hands for opponents and then chooses the line, which works on most deals.

I would like to see such an interface to software which would be a merger of simulation and Double Dummy solver with a different sort of output.

Give that software 26 cards for declarer and dummy.

Now I would like to specify some parameters as input, depending (among others) on how long I am prepared to wait for the result and the speed of my computer.

The input parameters would be:

How many deals (e.g. 1000) should be generated out of the remaining 26 cards for opponents for the double dummy solver to check
As a result the software would list probability of success for different incompatible lines of play for declarer and give their relative success rate.
Incompatible of course here means that you have to make a decision in the play affecting your success before having crucial information, like somebody showing out.
If line A always wins when line B does, they are not incompatible but line A is simply superior.
Of course you would also like to specify restrictions on the opponents hand, say West can not have more than 5 spades and 9 HCP.
You might want to specify the opening lead or even the first few tricks etc.

Once this has been accomplished it would not be very difficult to do the same from a defender's point of view.
The goal being defeating contracts or maximizing defensive tricks.

One problem alone is how you store and output different lines of play, which could be numerous, in a meaningful way.

At the moment we have this type of information only for the opening lead, but not for complete lines of play or defense.

Of course such a software might be a killer to challenging single dummy problems like the double dummy solver is to double dummy problems.
So my request is a double-edged sword.

Rainer Herrmann
1

#12 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 2012-July-13, 09:07

Quote

One thing which is bothering me when it comes to dmpro (don't know about other software) is that it doesn't run in parallel on multiple cores. As the problem of calculating double dummy results for many hands should scale linearly that would be huge boost on modern processors (like 8x faster on i7). It would require just few line of code more (assuming the software is written in C or C++) but without the source I can't do anything about it.
Same goes for dealing software, although I admit I have no idea if for example deal runs on multiple cores.


Deal is 1 processor only. But you can start several threads, assign each to a different processor, have each thread return some statistics, and combine the answers, to get more hands processed faster. (I didn't do that; but if I had a family of cases to simulate, I would have two problems going at once each on their own processor.)

I seem to recall that a new version of Bo Haglund's double dummy solver came out recently that has improved ability to take advantage of new hardware - but has not yet been integrated into the Andrews Deal package.

Deal is open source, though, if you want to try to improve upon it.
0

#13 User is offline   RossSCann 

  • PipPip
  • Group: Members
  • Posts: 25
  • Joined: 2012-July-06

Posted 2012-July-14, 18:24

View Postantonylee, on 2012-July-08, 22:24, said:

Thomas Andrews' Deal (http://bridge.thomasoandrews.com/deal/) is quite good.

I downloaded and extracted but it wouldn't work. It said it was missing a .dll but that dll was clearly present.
It is unfortnately written in some obscure script language.
We should be working in C++.
Ross
1

#14 User is offline   catch22 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 108
  • Joined: 2004-March-31

Posted 2012-July-15, 05:55

I wrote a program that uses a domain specific language that can be used to define any bidding system - It could be used as a deal simulator, but I use it to practice the bidding system I play with gnasher.

This is a snippet

1nt:"Strong NT" (p#3 15-17hcp s#5422|4333|4432|5332|5422|4441)
{ name f1NTResponses
	2c:"4M inv+ raise or 1-suited major bad suit or 1 suited minor fg" (p#2 4h 3-s 8+hcp, 4s 3-h 8+hcp, 6+h 12+hcp q#hh-h, 6+s 12+hcp q#hh-s, 6+c 10+hcp 3-s 3-h, 6+d 10+hcp 3-s 3-h, s#5422 4+d 4+c 10+hcp)
	{ name f1NT2C
		2d:"Forced"
		{ name f1NT2C2DResponses
			2h:"Spades inv+" (4+s 8+hcp [$M=s, $OM=h])
			{
				2s:"Forced" ->f1NTInvPlusOne4CardMajor
			} 
			2s:"1-suiter minor gf or 22(54) gf" (6+c 10+hcp, 6+d 10+hcp, s#5422 4+d 4+c 10+hcp)

1

#15 User is offline   Scarabin 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 382
  • Joined: 2010-December-30
  • Gender:Male
  • Interests:All types of games especially bridge & war games.
    old bidding systems & computer simulation programming.

Posted 2012-July-16, 02:38

View Postcatch22, on 2012-July-15, 05:55, said:

I wrote a program that uses a domain specific language that can be used to define any bidding system - It could be used as a deal simulator, but I use it to practice the bidding system I play with gnasher.

This is a snippet

1nt:"Strong NT" (p#3 15-17hcp s#5422|4333|4432|5332|5422|4441)
{ name f1NTResponses
	2c:"4M inv+ raise or 1-suited major bad suit or 1 suited minor fg" (p#2 4h 3-s 8+hcp, 4s 3-h 8+hcp, 6+h 12+hcp q#hh-h, 6+s 12+hcp q#hh-s, 6+c 10+hcp 3-s 3-h, 6+d 10+hcp 3-s 3-h, s#5422 4+d 4+c 10+hcp)
	{ name f1NT2C
		2d:"Forced"
		{ name f1NT2C2DResponses
			2h:"Spades inv+" (4+s 8+hcp [$M=s, $OM=h])
			{
				2s:"Forced" ->f1NTInvPlusOne4CardMajor
			} 
			2s:"1-suiter minor gf or 22(54) gf" (6+c 10+hcp, 6+d 10+hcp, s#5422 4+d 4+c 10+hcp)



May we know the name of the domain specific language you use, please? Your snippet is interesting in a tantalizing sort of way.
0

#16 User is offline   catch22 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 108
  • Joined: 2004-March-31

Posted 2012-July-16, 09:06

View PostScarabin, on 2012-July-16, 02:38, said:



May we know the name of the domain specific language you use, please? Your snippet is interesting in a tantalizing sort of way.


It is my own DSL, which originally was defined using ANTLR. I have recently ported it to XText so I could create an eclipse based editor.

Basic syntax is:

<BID>:<DESCRIPTION> <PRIORITY + CONSTRAINT>
{
<BID>:<DESCRIPTION> <PRIORITY + CONSTRAINT>
<BID>:<DESCRIPTION> <PRIORITY + CONSTRAINT>
....
}

Continuations can be embedded or can be calls to fragments

e.g.
1H : "5 card major" (5+h 10+hcp [$M=h]) ->f5CardMajorCont
1S : "5 card major" (5+s 10+hcp [$M=s]) ->f5CardMajorCont

$M is a variable that can be used in subsequent constraints.

e.g.
f5CardMajorCont
2$M : "Rebid major" (6+$M)
0

#17 User is offline   Scarabin 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 382
  • Joined: 2010-December-30
  • Gender:Male
  • Interests:All types of games especially bridge & war games.
    old bidding systems & computer simulation programming.

Posted 2012-July-18, 02:46

Thanks Catch22. I am currently researching expert systems (probably a dead end since all rule based systems are expert systems) and database applications of Visual Basic. I am a very amateur programmer!
0

#18 User is offline   blackshoe 

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

Posted 2012-July-18, 08:06

There was once a bridge playing "expert system" called, iirc, "Bridge Partner". You taught it your bidding system by bidding many hands. Eventually it figured out what you were doing. That was the theory, anyway. I never did get it to that point. I think the project was abandoned (or moved to Windoze — either one would spell its end for me).
--------------------
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

#19 User is offline   Scarabin 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 382
  • Joined: 2010-December-30
  • Gender:Male
  • Interests:All types of games especially bridge & war games.
    old bidding systems & computer simulation programming.

Posted 2012-July-19, 03:28

View Postblackshoe, on 2012-July-18, 08:06, said:

There was once a bridge playing "expert system" called, iirc, "Bridge Partner". You taught it your bidding system by bidding many hands. Eventually it figured out what you were doing. That was the theory, anyway. I never did get it to that point. I think the project was abandoned (or moved to Windoze — either one would spell its end for me).


Cannot trace it through Google so probably abandoned. On a related point, has anyone found a learning program (neural networks in the jargon?) that is beyond trivial and that actually works?
0

#20 User is offline   Scarabin 

  • PipPipPipPip
  • Group: Full Members
  • Posts: 382
  • Joined: 2010-December-30
  • Gender:Male
  • Interests:All types of games especially bridge & war games.
    old bidding systems & computer simulation programming.

Posted 2012-July-22, 19:36

Thanks for your replies. My first aim, at least, is satisfied. :rolleyes:

While I cannot claim to have discovered overwhelming support for a collaborative bridge simulation, I guess we have reached the stage where I should put the question directly:"Would you join a group effort to write a new bridge simulation?".

I will open a new topic to do this. :)
0

  • 2 Pages +
  • 1
  • 2
  • 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