Expand description
§dds-bridge
A Rusty API for DDS, the double-dummy solver for the game of bridge.
This crate aims to be the building block of computer bridge in Rust.
It links to dds-bridge/dds, the fundamental C++ double dummy
solver, via our system crate.
§Installation
cargo add dds-bridgeA C++ toolchain is required to build the underlying dds-bridge-sys
crate. On most Linux distributions the default g++ and make are
enough; macOS needs the Xcode Command Line Tools; Windows builds via
MSVC.
§Quick start
Parse a PBN-formatted deal, solve it for all strains and seats, and score a specific contract:
use dds_bridge::{Contract, Deal, Penalty, Solver, Strain, Seat};
// Each player holds a 13-card straight flush in one suit.
let deal: Deal = "N:AKQJT98765432... .AKQJT98765432.. \
..AKQJT98765432. ...AKQJT98765432".parse()?;
let solver = Solver::lock();
let tricks = solver.solve_deal(deal)?;
// 4♠ by North, scored as if 10 tricks taken, not vulnerable.
let contract = Contract::new(4, Strain::Spades, Penalty::Undoubled);
println!("{}", contract.score(10, false));§Features
serde(optional) —Serialize/Deserializefor all public types. Human-readable formats (JSON, YAML, TOML) round-trip through theDisplay/FromStrtext form; binary formats use a compact derived representation.
§Minimum supported Rust version
Rust 1.85 (the first release supporting Rust 2024 edition).
§License
Licensed under the Apache License, Version 2.0.
Re-exports§
pub use contract::Bid;pub use contract::Contract;pub use contract::Level;pub use contract::Penalty;pub use deal::Card;pub use deal::Deal;pub use deal::Hand;pub use deal::Holding;pub use deal::Rank;pub use deal::Seat;pub use deal::SeatFlags;pub use solver::Solver;
Modules§
Structs§
- Parse
Strain Error - Error returned when parsing a
Strainfails - Parse
Suit Error - Error returned when parsing a
Suitfails - Suit
From Notrump Error - Error raised when converting
Strain::Notrumpto a suit