Get bridge-solver

A double-dummy solver with par scoring, card-by-card play analysis and a claim checker. The same engine runs in each of these; pick whichever suits you.

In your browser

Double-dummy analysis
Paste a PBN deal, a LIN file or a BBO handviewer link for the double-dummy table, and every card that gave a trick away. Nothing is uploaded.
Claim checker
Load a hand, go to any point in the play, and check a claim by declarer or either defender, or find the most each of them could claim.
Benchmarks
Times the analysis and the claim checker on fixed work, so you can compare devices, and checks your browser's answers against the native tools'.

Command-line tools

Download the archive for your system from the latest release: macOS (Apple Silicon or Intel), Linux or Windows. Each holds three tools:

bridge-solver
Adds double-dummy tables, par score and par contract to PBN files, in the tags Bridge Composer reads. Uses every core.
solver-diag
Solves a single deal and prints its table.
bridge-claim
Checks claims from a file, and benchmarks the claim checker on every core.
bridge-solver -w -i deals.pbn      # annotate a file in place
bridge-claim bench                 # time the claim checker

The downloads are not signed. On a Mac, clear the download flag with xattr -d com.apple.quarantine <file>. On Windows, choose "More info", then "Run anyway". Every option is in the command-line guide.

Python new in 2.1.0

pip install bridge-solver
import bridge_solver as bs

deal = "N:AKQT3.J6.KJ42.95 652.AK42.AQ87.T4 J74.QT95.T.AK863 98.873.9653.QJ72"
bs.dd_table(deal)["N"]               # {'C': 8, 'D': 7, 'H': 8, 'S': 10, 'NT': 9}
bs.par(deal, "None")                 # {'optimum_score': 'NS 420', 'par_contract': 'NS 4S=', ...}
bs.check_claim(deal, "S", "N", 10)   # {'verdict': 'invalid', ...}

Prebuilt for Linux, macOS and Windows, Python 3.9 and later; nothing to compile. The package's README covers every function.

C, and any language that can call C new in 2.1.0

Each release has a bridge-solver-c-<system> archive: a header, shared and static libraries, and an example. It works from C and C++, and from C#, Go, Java, Swift and others through their foreign-function interfaces. Most calls take and return JSON, so a binding stays small.

unsigned char tricks[20];
bs_dd_table_tricks("N:AKQT3.J6.KJ42.95 ...", tricks);   /* rows N E S W, columns C D H S NT */

How to link it on each system: the C library's README.

JavaScript and Rust

WebAssembly
bridge-solver-wasm.tar.gz in each release, for browsers and Node. It's what this site runs on.
Rust
bridge-solver = { git = "https://github.com/bridge-craftwork/bridge-solver" }

How it works

How the claim checker works explains what makes a claim valid, how the checker reaches its answer quickly, and where its ideas came from. The double-dummy search is a port of Hanhong Xue's bridge-solver. The source is MIT OR Apache-2.0.

Privacy