pons-dds 0.1.0

Pure-Rust double dummy solver for contract bridge
Documentation

pons-dds

CI Crates.io Docs.rs Benchmarks

Pure-Rust double dummy solver for contract bridge. No C++ compiler required — compiles anywhere Rust runs.

Usage

[dependencies]
pons-dds = "0.1"
use contract_bridge::{FullDeal, Seat, Strain};
use pons_dds::{solve_deal, solve_deals};

// Solve one deal — fans the 5 strains across rayon workers.
let deal: FullDeal = "N:AKQJT98765432... .AKQJT98765432.. \
                      ..AKQJT98765432. ...AKQJT98765432".parse()?;
let table = solve_deal(deal);
assert_eq!(table.get(Strain::Spades, Seat::North), 13);

// Solve many deals in parallel — preferred for batch workloads.
let tables = solve_deals(&deals);

For sequential or diagnostic use, drive Solver directly:

use contract_bridge::Strain;
use pons_dds::{Solver, solve_deal_on};

let mut solver = Solver::new(Strain::Notrump);
let table = solve_deal_on(&mut solver, deal);

Performance

Benchmarked with cargo bench (seed 0, 200 random deals, 32-core machine).

Engine Serial (1 thr) Parallel (32 cores)
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. 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.

License

Apache-2.0