Skip to main content

Module solver

Module solver 

Source
Expand description

Double-dummy solver and par-calculation bindings built on dds_bridge_sys.

§Panic policy

The solver entry points in this module — calculate_par, calculate_pars, and the Solver methods solve_deal, solve_deals, solve_board, solve_boards, analyse_play, and analyse_plays — are not expected to panic. They map DDS status codes through an internal helper that panics on error, but reaching that panic means either invalid input slipped past a safe constructor or DDS itself misbehaved. Either case is a bug — please report it.

This policy does not cover validator panics from safe constructors (e.g. TrickCountRow::new), which panic by design on out-of-range inputs and have try_* counterparts for fallible construction.

Structs§

Board
A snapshot of a board
CurrentTrick
Trick-in-progress — 0 to 3 cards played, in playing order
FoundPlays
Solved plays for a board
InvalidTrickCount
Error returned when a trick count is outside 0..=13
NonEmptyStrainFlags
A guaranteed non-empty StrainFlags
Objective
A board and its solving target
Par
Par score and contracts
ParContract
Par contract
ParseVulnerabilityError
Error returned when parsing a Vulnerability fails
Play
A play and its consequences
PlayAnalysis
Double-dummy trick counts before and after each played card in a trace
PlayTrace
A starting board and a sequence of cards played from it
Solver
Exclusive handle to the DDS solver
StrainFlags
Flags for the solver to solve for a strain
SystemInfo
Information about the DDS library and how it was built
TrickCount
A number of tricks in 0..=13
TrickCountRow
Tricks that each seat can take as declarer for a strain
TrickCountRowHex
Hexadecimal view of a TrickCountRow from a seat’s perspective
TrickCountTable
Tricks that each seat can take as declarer for all strains
TrickCountTableHex
Hexadecimal view of a TrickCountTable from a seat’s perspective
Vulnerability
Vulnerability of pairs

Enums§

BoardError
Error returned when constructing a Board with invalid invariants
Compiler
C++ compiler used to build the DDS library
CurrentTrickError
Error returned when pushing cards to a CurrentTrick
Platform
OS platform reported by the DDS library
RevokePosition
Position of the revoking card within the current trick
Target
Target tricks and number of solutions to find
Threading
Threading model used by the DDS library

Functions§

calculate_par
Calculate par score and contracts for a deal
calculate_pars
Calculate par scores for both pairs