1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* @file calc_par.hpp
* @brief C++ interface for par calculation with explicit solver context.
*
* This header provides C++ overloads for par calculation that accept explicit
* SolverContext, allowing clients to manage solver state across multiple operations.
*
* @copyright (C) 2006-2014 by Bo Haglund / 2014-2018 by Bo Haglund & Soren Hein.
* @see LICENSE and README.
*/
// Naming note: New C++ APIs in DDS 3 use snake_case (calc_par, calc_par_from_table).
// Legacy C/C++ wrapper APIs may still use historical PascalCase names (for example SolveBoard).
/**
* @brief Calculate par score and contracts for a deal table.
*
* Computes the double dummy table for the given deal, then calculates
* par score and contracts based on vulnerability. This version creates
* a temporary SolverContext internally.
*
* @param table_deal Deal represented as card holdings for each hand
* @param vulnerable Vulnerability (0=None, 1=Both, 2=NS, 3=EW)
* @param table_results Output: double dummy table results
* @param par_results Output: par score and contract strings
* @return Error code (RETURN_NO_FAULT on success)
*
* @note This function is equivalent to calling CalcDDtable + Par from C API
*/
auto int;
/**
* @brief Calculate par score and contracts with explicit solver context.
*
* C++ overload that accepts an explicit SolverContext. The context enables
* efficient reuse of allocated solver resources (memory buffers, threading
* state, and TT allocation metadata) across multiple par calculations.
*
* @note DD table calculation evaluates all 5 strains and resets TT contents on
* each trump change, so this path primarily reuses allocations/thread state
* rather than TT entries between strains.
*
* Internally computes the DD table using context-aware calc_dd_table(),
* then calculates par score from the table.
*
* @param ctx Solver context for resource management and TT reuse
* @param table_deal Deal represented as card holdings for each hand
* @param vulnerable Vulnerability (0=None, 1=Both, 2=NS, 3=EW)
* @param table_results Output: double dummy table results
* @param par_results Output: par score and contract strings
* @return Error code (RETURN_NO_FAULT on success)
*/
auto int;
/**
* @brief Calculate par from pre-computed double dummy table.
*
* When DD table is already available, this function computes only the par
* analysis without recalculating the table. Does not require SolverContext.
* This is a thin wrapper around the C API Par() function.
*
* @param table_results Input: pre-computed double dummy table
* @param vulnerable Vulnerability (0=None, 1=Both, 2=NS, 3=EW)
* @param par_results Output: par score and contract strings
* @return Error code (RETURN_NO_FAULT on success)
*/
auto int;