gamesmathematical programsotherabout author

Bridge studio

ru

Introduction

Bridge studio is fast and powerful solver of bridge double dummy and preferans problems. This program is freeware with open source code. The basic features are

Note. Since version 5.0 bts and pts files format are changed. Now it's text files which can include list of problems which can be compound of bridge and preferans problems. Bridge problems can store pbn tags. Now there is no difference between bts and pts formats. List of problems and game type are defined using file content. Bts, pts files of previous versions were not text and can consist of one bridge problem for bts file and one preferans problem for pts file. For backward compatibility old formats reading are fully supported.

Screenshots

Click on pictures for enlargement

Solution for all declarers and trumps

Bridge Studio could be useful for competitions and commentators. First it can find optimal contract for every pair north/south and east/west. The second it can estimate number of tricks for every card for example best attack turn. Consider sample bridge hand which was dealt on competition.

North
J 5 4 3
Q J 8 2
-
Q J 8 5 2
West
T 9
7 6 5
T 9 7 5 4
7 6 3
East
A K 7 6 2
K 9
A Q
A K T 4
South
Q 8
A T 4 3
K J 8 6 3 2
9

Each player can be declarer and he/she can bid any suit or no trump game. The solver can calculate how many tricks every side can take for any trump and every declarer. For example if south bid NT game then pair north/south will take six tricks, if he bid clubs then pair take only five tricks. So we can create a table with tricks under optimal game for every declarer and every suit+NT.

Tricks chart

trump
NT
d
e
c
l
a
r
e
r
north69566
east74887
south68556
west74777

Next we can create table of achievable contracts for every declarer and every suit+NT and best contracts table.

Achievable players contracts

trump
NT
d
e
c
l
a
r
e
r
north-3---
east1-221NT
south-2---
west1-111NT

Best contract levels

north 3
east1 2 2 1NT
south 2
west1 1 1 1NT

Now consider how solve option is working for preferans game.

Preferans

Let's take one of well known preferans problem which is called mizer of Sofia Kovalevskaya.

North
10 9 8 7
9 8
9 8 7
8
West
Q J
J 7
A K Q 10
9 7
East
A K
A K Q 10
J
Q J 10

In preferans game player who do a very first move is not strictly depends on declarer. So when program solves problems for all declarers and trumps it fixes player which do very first turn. In case of preferans game we have three players and four possible trumps or NT game or mizer game. So totally we have to solve 18 problems.

Tricks chart

trump
NTmizer
d
e
c
l
a
r
e
r
north000002
east5959610
west314140

Next we can create table of achievable contracts for every declarer and every suit+NT and best contracts table.

Achievable players contracts

trump
NTmizer
d
e
c
l
a
r
e
r
north------
east-9-96NT-
west-----+

Best contract levels

north-
east9 9 6NT
westmizer

Interface language

By default language of the interface is english. There are english, russian, italian languages available at the moment. You can change language using Language menu. Language settings are stored in special lng file which has simple text format. To create new language file just copy existing file and change its copy using text editor. Name of file should be name of language in English, for example, french.lng. After it copy new language file to bin/lng folder. Additionally it's possible to add country flag image to bin/images folder. The name of image file should be the same with name of language file and have png extension. If you create new language file please write me.

Note. Current language will be stored automatically on exit.

Loading problems from pbn and deep finesse files

The solver can load the problems from pbn (portable bridge notation) or deep finesse files. Pbn format is the international standard for bridge notation. You can just drag and drop one or many files to program window. Also you can do the same with directories. If directory has some pbn, df, bts, pts files then they will be loaded. If directory has subdirectories they are read recursively.

Setup new problem

To setup new problem select menu item Problem/New or press Ctrl+N. After it all of the cards will be on the west. Now click on the cards which you want to move to the north. Cards moves to north until it have less than 13 cards then cards will move to east etc. If you click on the card which has north, east or south then it moves to the west. As well you can drag the cards to every player or to the absent region. If you press Ctrl+left mouse button then card moves to the player to whom you move last card. Let you need move cards 2 3 9 10 6 to south. You can drag every card to south, but it's possible to do it easier. Drag 2 to south, after point to 3 and press ctrl+left mouse button. 3 moves to south. The same you can do with other cards. After it setup trump or non-trump game, contract and player who will make first move by clicking on the arrow on the table. As well you can click to inner arrow rectangle to switch move to every player. If the first move already have done then drag current card to inner rectangle. An arrow in the inner rectangle will show on the next player. You can do the second move etc.

Note. It's possible to setup the problem where every player have 1..13 cards. For example each player can have 8 cards or it's possible to setup double dummy problem without very first turn.

Problem analysis

Press button or click right mouse button to find best move. If button is not active then problem is invalid, for example, north and south have different number of cards. The solver will show you best move, number of tricks for each side if they will play optimally. Now you can press or right mouse button again or do the move yourself. You can undo the moves, just click on the inside card. One can undo several moves by clicking on leading card (or any other card) in current trick. There are helpful toolbar buttons undo all, undo, redo, redo all.

Problem edit

One can change all problem parameters such as trump, card position, contract in the middle of the game. Click problem/edit problem menu item or press Ctrl+E. After it you can edit current problem.

Save problem to html file

This option is useful for publication problems in the internet, and for printing. It's possible to store problem with or without pictures.

problemHughDarwen 1
declarerSouth
contract6NT
saved by bridge studio
South to make six no-trumps. Difficulty 4 http://www.doubledummy.net/Problem0001.html
North
-
A 4 3 2
Q 3
A K Q 4 3 2
WestEast
Q J 45 10 9 8 7 6
10J  Q 9 8 7 6
K 7 6 5 4 J 10 9
J 10 9 -
South
-
A 4 3 2
Q 3
A K Q 4 3 2

When bridge studio stores the problem it adds html-tag <p> to file, for example, for this problem it adds <p id='HughDarwen1'> to html file. You can store the problem with best move and/or number of tricks in optimal game. Below you can see the same problem, but stored with best move and number of tricks.

problemHughDarwen 1
declarerSouth
contract6NT
best moveQ
number of tricks12/1
saved by bridge studio
South to make six no-trumps. Difficulty 4 http://www.doubledummy.net/Problem0001.html
North
-
A 4 3 2
Q 3
A K Q 4 3 2
WestEast
Q J 45 10 9 8 7 6
10J  Q 9 8 7 6
K 7 6 5 4 J 10 9
J 10 9 -
South
-
A 4 3 2
Q 3
A K Q 4 3 2

Note. If you store the problem with best move or with number of tricks then you should wait until program find best move. It can take some time.

Note. Html file content depends on the language interface.

Converter

One can convert library of pbn, deep finesse, bts, pts files to pbn, deep finesse, bts, html formats. To convert files select addons/convert menu item, then add files or folders which you want to convert and click OK. You can store current problems list. Just select menu problem/save as... and select output format.

Estimate all turns

This feature is very useful for problem analysis. The estimate all turns option is in options menu and has five possibilities.

Autoplay mode

One can setup autoplay mode using menu options/autoplay on sequences. If this option is on then program will do turns automatically if all possible turns are in sequence.

Bridge/preferans

To switch from bridge to preferans and vice versa use menu addons/bridge or addons/preferans.

Note Game type automatically saved upon exit.

Versions history

version 5.0 26 march 2017

source code had been rewritten for gtk 3.20.6
added support of problems list
added new bts, pts file format, now it's text files which support problems list and pbn tags. One file can include bridge and preferans problems
added problem list editor
added save problems list to many files
converter can store list to html, pbn, df, bts file. It's possible to store list to several files
added contract field on toolbar
added drag & drop option for several files and folders, folders are read recursively
added score calculator for bridge
added save to image file option
added solid color or image selection for custom skin
added font color selection for skins
added new deck with big cards
added detailed information about error upon file opening
added loading many file using command line
improved reading of pbn, df files (now full reading)
improved pbn editor
improved skin support
improved save to html files
accelerate program loading (check new version is in other thread)
improved support of small notebook monitors
improved new language addition, now it's possible just copy new language file to bin/lng folder and program on loading read new file. As well it's possible to add language icon to folder bin/images
collections of problems from HughDarwen and GeorgeCoffin folders now is in one file for every forder. As well extended list from Competition subfolder. Now it includes all of problems. Add all other collections Bergholt, Yarborough, Pachabo. So now all problems from www.doubledummy.net are in bts library. Preferans problems now are in one file. For all problems contract is set where it's possible.
click on inner card undo needed turns
click on card which is next in list redo turn
extended save modified document option

version 4.0 22 december 2014

source code had been rewritten for gcc compiler and crossplatform library gtk+ version 3.6.4, IDE is Eclipse CDT
add solution for all possible trumps and declarers
add problem rotation
add special support for small monitors
application is easy configurable (bridge.cfg became text file, bridge.css is also text file)
add font selection
html converter now supports drag & drop option
improve sequence detection for autoplay on sequence option

version 3.01 20 september 2012

setup font color manualy
setup card indent inside suit manually

version 3.0 11 september 2012

fixed bug with window size on windows Vista
fixed bug with LastTrick and Status windows placement for Windows Vista and Windows 7
added file association (bts, pts, pbn)
fixed bug with cursor capture
fixed bug with editing problem description
some flickers were removed
fixed bug with corners of cards
improve storing of html files
add italian language
add check that file with problem from library already exists
click on any player name in preferans to change player
click on any arrow rectangle to switch first turn (bridge+preferans)
remove many pictures (this produce shadows for some windows versions)
remove a lot of other bugs :)

version 2.23 8 february 2012

code is adopted for gcc compiler
small memory leak fixed
update mechanism is improved

version 2.22 17 may 2011

change saving type of html from unicode to image
add saving type of html without images
remove local references for pictures

version 2.21 5 february 2011

version 2.20 2 december 2010

version 2.19 10 june 2008

version 2.18 26 april 2008

version 2.17 13 december 2007

version 2.16 16 august 2007

version 2.15 30 july 2007

version 2.14 17 july 2007

version 2.13 4 july 2007

version 2.12 31 may 2007

version 2.11 30 march 2007

version 2.10 14 march 2007

version 2.9 9 december 2006

version 2.8 31 october 2006

version 2.7 1 october 2006

version 2.6 7 february 2005

version 2.5 4 november 2003

version 2.4 3 september 2003

version 2.3 18 july 2003

version 2.2 1 july 2003

version 2.1 16 june 2003

version 2.0 2 june 2003

version 1.2 28 april 2003

version 1.1 5 february 2003

version 1.01 16 january 2003

version 1.0 15 january 2003

History of preferans problem solver

At first program could solve only preferans problems. After the third version was issued I started to develop solver of both bridge and preferans problems.

version 3.0 13 july 2002

version 2.2 25 june 2002

version 2.1 7 june 2002

version 2.0 1 june 2002

version 1.1 20 may 2002

version 1.0 7 may 2002