pons-dds
Pure-Rust double dummy solver for contract bridge. No C++ compiler required — compiles anywhere Rust runs.
Usage
[]
= "0.1"
use ;
use ;
// Solve one deal — fans the 5 strains across rayon workers.
let deal: FullDeal = "N:AKQJT98765432... .AKQJT98765432.. \
..AKQJT98765432. ...AKQJT98765432".parse.unwrap;
let table = solve_deal;
assert_eq!;
// Solve many deals in parallel — preferred for batch workloads.
let deals = ;
let tables = solve_deals;
assert_eq!;
For sequential or diagnostic use, drive Solver directly:
use Strain;
use ;
# let deal: FullDeal = "N:AKQJT98765432... .AKQJT98765432.. ..AKQJT98765432. ...AKQJT98765432".parse.unwrap;
let mut solver = new;
let table = solve_deal_on;
Scope
This release ships the Solver API: a per-strain solver that produces one
strain's row of a TrickCountTable for a FullDeal, plus the rayon-parallel
solve_deal (single-deal) and solve_deals (batch) helpers that assemble the
full 5 × 4 table, and the sequential single-thread solve_deal_on for
deterministic profiling. The internal substrate (position state, move
generator, search engine, transposition table, and friends) remains
crate-private.
Performance
Benchmarked with cargo bench (seed 0, 200 random deals, 16c/32t machine).
| Engine | Serial (1 thr) | Parallel (32 thr) |
|---|---|---|
| ddss 0.1 (DDS 2.9, C++ FFI) | 131.5 ms/deal | 9.9 ms/deal |
| pons-dds (DDS 2.9, pure Rust) | 149.3 ms/deal | 13.2 ms/deal |
| dds-bridge 0.19 (DDS 3.0, C++ FFI) | 193.7 ms/deal | — † |
† dds-bridge 0.19 ships single-threaded; 0.20+ adds a parallel path.
Head-to-head benchmarks against each C++ crate live in their respective
repositories: ddss/benches/compare_pons_dds.rs and
dds-bridge/benches/compare_pons_dds.rs. They are kept separate because
ddss-sys and dds-bridge-sys both vendor the DDS C++ symbols and cannot
link into the same binary.
Acknowledgements
pons-dds is a line-by-line pure-Rust port of the DDS double dummy
solver by Bo Haglund and Soren Hein — specifically the DDS 2.9.0 engine as
carried by Robert Salita's ddss fork, whose C++ sources are
vendored under ddss-sys/vendor/src/ and cited per-module throughout this
crate's source: each ported module names its corresponding vendor file in its
docs, with ddss-sys/vendor/src/ABsearch.cpp the canonical reference for the
search. The alpha-beta search, transposition table, and move-ordering
heuristics all follow that reference; only the language and memory-safety
scaffolding are new. The same C++ engine is reachable from Rust through the
ddss / ddss-sys FFI crates,
which pons-dds benchmarks against above. Like DDS and ddss, pons-dds is licensed
under Apache-2.0.