Bridge studio | ru |
Note. Since version 5.2 the program works only under 64-bit operating systems. The version of windows must be at least Windows 7.
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
- full tree investigation to the end, the solver always will find the exact solution, which includes the best move and number of tricks in optimal game for north/south and east/west
- option of estimation of all moves. Program can estimate not only best move, but all other moves and show number of tricks for them
- solution of all declarers and trumps
- solution of all deals. For bridge you can choose a pair of players with unknown cards north/south or east/west. For preferans, you can make a search of all the hands of defenders. It is possible to search all the hands when the first move is not yet made or when one or more moves are made. One or more cards from players with unknown cards can be fixed. There is an export of all deals with the results in csv file
- expected value table calculation for solution of all deals depending on the contract
- the program finds one of the optimal line of the game (the sequence of the best moves), which are displayed in the panel of the best moves. You can click on them to make one or more best moves
- score calculator for both game types
- it's possible to setup problems with any number of cards, for example double dummy problem without very first turn or position after several tricks
- loading problems from pbn (portable bridge notation) and df (deep finesse) files, loading problems list from several files and folders
- program has inner formats bts, pts which are simple text, so it's possible to modify problems in text editor
- problem list editor
- pbn tags editor
- convert/save problems list to bts, pbn, df, html files
- save problems list to html file with best move and/or number of tricks in optimal game
- save problem to image file
- skins support. It is possible to choose a deck and arrows in vector or raster graphics format, font, background, set suits order and card order in suit
- the solver will find the second, third etc moves much faster than the first one, because it stores positions which already have been calculated
- multilanguage support: english, russian and italian interfaces are available now, it's easy to add new language file
- program has a big library with bridge and preferans problems which includes about 1000 problems
Screenshots
Solution of all declarers and trumps
It is possible to solve a problem for all declarers and trumps not only at the beginning of the game, but also after some tricks. In this case the taken tricks won't be counted, because in bridge the declarer determines who moves first, and the first move in the first trick is fixed, and in preference the tricks that were taken before the current position were taken under other conditions, for example whisters played together, and if one of whisters is considered as a player, then his strategy will change.
go to option description for preferansBridge
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. This task is in the library file bts/www.doubledummy.net-Problem0423.bts.
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 | north | 6 | 9 | 5 | 6 | 6 |
east | 7 | 4 | 8 | 8 | 7 | |
south | 6 | 8 | 5 | 5 | 6 | |
west | 7 | 4 | 7 | 7 | 7 |
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 | - | - | - |
east | 1 | - | 2 | 2 | 1NT | |
south | - | 2 | - | - | - | |
west | 1 | - | 1 | 1 | 1NT |
Best contract levels
north | 3 |
east | 1 2 2 1NT |
south | 2 |
west | 1 1 1 1NT |
Preferans
Consider one of well known preferans problem which is called misere 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 all three players can do first turn. In case of preferans game we have three possible declarers and four possible trumps or NT game or misere game (six different contracts). So totally we have to solve 3*3*6=54 problems.
Tricks and achievable players contracts table
The program calculates the number of tricks and possible achievable contracts for each player.
|
|
|
Solution of all deals
It is possible to make a search of all the hands when the first move has not yet been made or one or more moves have been made. Cards on the table are fixed and are not considered in the search. The option will be active as long as one of the players with unknown cards has at least one card left. If one of the players has \(c_1\) unfixed cards and the other has \(c_2\) unfixed cards, the total number of positions is equal to the binomial coefficient \(C^{c_1}_{c_1+c_2}\). The calculation time varies a lot from task to task. The program shows the remaining time while it's going through.
Note. It has been noticed that the number of variants increases about twice as much as the number of unknown cards increases by one. If we denote the total number of remaining cards by \(n=c_1+c_2\), then \(c_1\approx n/2\). Using Stirling's formula, you can get a very precise estimate of the binomial coefficient \(C^{n/2}_n\approx\sqrt{\frac{2}{\pi n}}\cdot 2^n\). You can see the deduction of the formula in logic. Below is a table of comparisons of exact and approximate values.
n | approximate value | exact value | error |
---|---|---|---|
26 | 10,501,063 | 10,400,600 | 0.97% |
20 | 187,079 | 184,756 | 1.26% |
go to option description for preferans
Bridge
For bridge, you can choose a pair of players with unknown cards north/south or east/west. When you change pairs of players, the calculation stops and starts again. The maximum number of deals, when the players have 13 cards each. The number of deals is C1326=10,400,600. Since problems take a very long time to calculate in the bridge, in order to get a more accurate estimate while the problem is not calculated to the end, before solving all variants are divided into chunks of 40 elements and then these chunks are randomly shuffled. In this case, if you wait until the end of the calculation - there will be a complete enumeration of all the deals. Consider the problem. The first move has not yet been made, the total number of options C1326.
|
|
If the first move is made, West has 12 cards left, his move is fixed. Then the number of options is reduced by half C1225=C1325=5,200,300.
|
|
If you make the first three or four moves in the first trick, the number of hands will decrease even further and equal C1224= 2,704,156. You can make several moves and calculate the deals, in the problem below the number of choices is C1019=C919=92,378
Preferans
In preferans program searchs all possible hands for whist or misere catcher players. The maximum number of hands is when two players have 10 cards each. Number of positions in this case equals C1020=184,756. Consider the Barbakaru problem, where the first move has not yet been made.
|
|
West and north made one move each. Cards lying on the table are fixed, the north has 9 cards, the number of options is reduced by half C919=C1019=92,378
Six moves are made. West and east have 8 cards each, the cards on the table are fixed. The number of deals is equal to C816=12,870.
Calculation of the expected value table
The table of mathematical expectations can be found in the menu advanced / solve all deals, contracts tab.
go to option description for preferans
Bridge
Knowing the number of tricks, when calculating all deals, you can calculate the mathematical expectation of the number of points for each of the contracts. The player can bid contract from 1 to 7. There are also two additional parameters, which can be chosen by the user:
contract type
- undoubled
- doubled
- redoubled
vulnerable
- yes
- no
Consider the problem. In this deal, the north/south pair takes eight tricks.
|
|
Going through the 5,200,300 east/west deals we get a table of probabilities.
Calculate the mathematical expectation of the north/south and east/west pair scores for the south 4 contract. Let's assume a simple contract (no double and redouble) and no vulnerable. Then the points table below will be as shown, we are interested in cases from 7 to 11 tricks.
Knowing the probabilities prt and the scores Sns(t), Sew(t), we can calculate the mathematical expectations. $$ e_{ns}=\sum\limits_{t=0}^{13} S_{ns}(t)\times pr_t \hspace{1cm} e_{ew}=\sum\limits_{t=0}^{13} S_{ew}(t)\times pr_t=-e_{ns} $$ From this we obtain the values of mathematical expectations
In a similar way, mathematical expectations are calculated for other contracts (1-7) and parameters (contract type and vulnerability).
Preferans
Knowing the number of tricks when counting all the deals, it is possible to calculate the mathematical expectations for each of the contracts. In case of trump or no-trump game a player can bid from 6 to 10 tricks inclusive, in case of misere game only one contract. There are also two additional parameters that can be selected by the user:
number of players
- 3 players
- 4 players
whist type (only for non-misere games)
- whist on the favorable hands, pass on the rest
- whist on the favorable hands, half-whist on the rest
- whist always
- half-whist always
- everybody always pass
Calculation of the expected value table for a non-misere game.
Consider the deal from "Preferance Fridays" tv-show. South, assuming a bad deal, bid 8, but he could bid 9. Which contract is more profitable for him? Searching all deals lets you know which contract will give the player more points. Let's look at four possibilities: playing 3 or 4 players, and contract 8 or 9. The calculation will be done for the Sochi scoring.
|
|
Let's introduce the notation
- pgi - the difference of the pool and the mountain of the i-th player
- vij - whist point of i-th player to j-th player
- p - number of players (three or four)
- t - number of tricks (from 0 to 10)
- prt - probability that declarer takes t tricks
- Si - score of i-th player
- Si(t) - score of i-th player if declarer takes t tricks
- for three players 103(2pg1-pg2-pg3)+(v12-v21)+(v13-v31)
- for four players 104(3pg1-pg2-pg3-pg4)+(v12-v21)+(v13-v31)+(v14-v41)
In general, the score of the n-th player is calculated by the formula
$$ S_n=\frac{10(p-1)}{p}pg_n + \sum\limits_{\substack{i=1 \\ i\neq n}}^pv_{ni}-v_{in}-\frac{10}{p} pg_i $$In this hand we will assume that player number 1 is declarer, so pg2=pg3=pg4=0 and vij=0 if i=1 or j≠1 at any scenario. Let's go through all the north and east deals and get that if the trump is a diamond, the south takes from 7 to 10 tricks.
Let's assume that the north (player number 2) whists only at favorable deals, i.e. when the south doesn't take 10 tricks, and the east (player number 3) always passes. In this case, the north will take at least one trick and get nothing in the mountain. Then one can calculate how many points the south will get in the pool/mountain and how many whists the other players will take for a certain number of tricks, and then calculate the score for each player. Calculated scores are highlighted in yellow.
Now, knowing the probabilities and scores, we can calculate the mathematical expectation of the score of the n-th player, which is \(e_n=\sum\limits_{t=0}^{10} S_n(t)\times pr_t\). As a result we get two expectation tables. In both cases it is more profitable to bid the 9 contract than the 8 contract.
Calculation of the expected value table for a misere game.
Consider the Kovalevskaya misere problem. North plays a misere contract, and in this deal he takes two tricks.
|
|
Let's introduce the notation
- p - number of players (three or four)
- t - number of tricks (from 0 to 10)
- prt - probability that declarer takes t tricks
- S1(t) - score of declarer if he takes t tricks
- Sj(t) - score of j-th player (2 ≤ j ≤ p) if declarer takes t tricks (the scores are equal for all players)
Let's go over all of the deals of the west and the east, and get a table of the tricks of the north.
In the case of a misere contract, whists are not written, only a pool / mountain for a misere player. 10 to the pool in case he didn't take any tricks (t=0), and 10×t to the mountain if t>0. Now you can calculate the number of player's points using the formula above. If the declarer didn't take any tricks (t=0), then S1(0)= 100×(p-1)p. If the declarer took at least one trick (t>0), then S1(t)= – 100×(p-1)×tp. Now count the points of the catchers. Let's use the fact that the sum of all players' points must be equal to zero, and the points for all catchers are equal. We obtain the equation S1(t)+(p-1)S2(t)=0 hence S2(t)= – S1(t)p-1. Now you can get a table of points for the misere player and catchers for three and four players depending on the number of tricks taken by a declarer. We are concerned with the cases where the number of tricks is not greater than six.
Now let's calculate the mathematical expectation of the n-th player's score \(e_n=\sum\limits_{t=0}^{10} S_n(t)\times pr_t\). The result gives us two tables with expected values.
Hand analysis (best moves panel)
Doing a hand analysis, the program finds the sequence of the best moves, until the end of the game and displays it. First it finds the best move t1, then the best move t2 after move t1, then the best move t3 after t1 and t2, and so on. Thus, the program reaches the end of the game and finds the optimal sequence of moves. Any of the best moves can be clicked, in which case the moves from the beginning of the analysis, to the clicked move, will be made. If at the moment of pressing the program calculates the best move or evaluates all moves, nothing will happen, because this option is inactive.
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.
|
|
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.
|
|
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.
- don't rate turns - Computer finds best move and will not estimate any turns
- rate only best turn (partial tricks) - Computer finds best move and shows estimation of best turn and all other cards with the same sequence. Tricks which current side already has taken will not be added to estimation
- rate only best turn (total tricks) - Computer finds best move and shows estimation of best turn and all other cards with the same sequence. Tricks which current side already has taken will be added to estimation
- rate all turns (partial tricks) - Computer finds best move and shows estimation of all possible moves. Tricks which current side already has taken will not be added to estimation. It's take time to estimate all possible moves
- rate all turns (total tricks) This options is used by default. - Computer finds best move and shows estimation of all possible moves. Tricks which current side already has taken will be added to estimation. It's take time to estimate all possible moves
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.