1
Bo Haglund, Bob Richardson
5
Short description of the DLL functions supported in Double Dummy Problem Solver 1.1
8
extern "C" __declspec(dllimport) int __stdcall SolveBoard(struct deal, int target,
9
int solutions, int mode, struct futureTricks *futp);
11
/* Before SolveBoard can be called, a structure of type "futureTricks" must be declared.
13
SolveBoard returns a status integer, "no fault" means the DLL supplies the trick data in the
14
"futureTricks" type structure.
19
-3=target > Number of tricks left,
27
-12=Suit or rank value out of range for deal.currentTrickSuit or deal.currentTrickRank.
29
Structure ”deal” defines all data needed to describe the deal to be analyzed.
31
int trump; /* I.e. which suit that is trump or if contract is NT, Spades=0, Hearts=1,
32
Diamonds=2, Clubs=3, NT=4 */
33
int first; /* 0-3, 0=North, 1=East, 2=South, 3=West , Leading hand for the trick.*/
34
int currentTrickSuit[3]; /* 0-3 for up to 3 cards in the order played */
35
int currentTrickRank[3]; /* 2-14 for up to 3 cards */
36
unsigned int remainCards[4][4]; /* 1st index hand (0-3), 2nd index suit (0-3), values as bitstring of ranks
37
bit 0=0, bit 1=0, bit 2=rank 2, ………. bit 14=rank 14, bit 15=0
38
for cards remaining after already played cards (cards already
39
played to the current trick are not included in this bitstring).
40
The decimal value for a card then range between 4 (=rank 2) and
41
16384 (Ace=rank 14). */
44
Parameter ”target” is the number of tricks to be won by the side to play, -1 means that the program
45
shall find the maximum number. For equivalent cards only the highest is returned.
47
Parameter ”solutions” defines how many card solutions that SolveBoard must return:
48
target=1-13, solutions=1: Returns only one of the cards. Its returned score is the same as target when
49
target or higher tricks can be won. Otherwise, score –1 is returned if target
50
cannot be reached, or score 0 if no tricks can be won.
51
target=-1, solutions=1: Returns only one of the optimum cards and its score.
52
target=0, solutions=1: Returns only one of the cards legal to play with score set to 0.
53
target 1-13, solutions=2: Return all cards meeting target. Their returned scores are the same as
54
target when target or higher tricks can be won. Otherwise, only one card
55
is returned with score –1 if target cannot be reached, or score 0 for all cards
56
legal to play if no tricks can be won.
57
target –1, solutions=2: Return all optimum cards with their scores.
58
target=0, solutions=2: Return all cards legal to play with scores set to 0.
59
target irrelevant, solutions=3: Return all cards that can be legally played with their scores in
62
Parameter ”mode” defines the DLL mode of operation. This mode does not affect the DLL if there are multiple choices for cards to play. If there is just one card to play, or multiple cards that are all
63
equivalent, this mode determines whether or not the DLL will search to find the score.
64
mode=0: Do not search to find the score if the hand to play has only one card, including its equivalents,
65
to play. Score is set to –2 for this card, indicating that there are no alternative cards. This mode
66
is very fast but you don’t
67
mode=1: Always search to find the score. Even when the hand to play has only one card, with possible
69
mode=2: As for mode=1, but the transposition table contents is reused from the preceding SolveBoard
70
call. Deal must be the same, except for deal.first.
72
1st call: SolveBoard(deal, -1, 1, 1, &fut), deal.first=1, i.e. East leads.
73
2nd call: SolveBoard(deal, -1, 1, 2, &fut), deal.first=2, i.e. South leads.
74
3rd call: SolveBoard(deal, -1, 1, 2, &fut), deal.first=3, i.e. West leads.
75
4th call: SolveBoard(deal, -1, 1, 2, &fut), deal.first=0, i.e. North leads.
77
struct futureTricks { /* The DLL provides the score (number of tricks) that can be won by the card to
78
play defined by its suit and rank. Array of all alternative cards. */
79
int nodes; /* Number of searched nodes */
80
int cards; /* No of alternative cards */
81
int suit[13]; /* 0=Spades, 1=Hearts, 2=Diamonds, 3=Clubs */
82
int rank[13]; /* 2-14 for 2 through Ace */
83
int equals[13]; /* Bitstring of ranks for equivalent lower rank cards.
84
The decimal value range between 4 (=2) and 8192 (King=rank 13). When there
85
are several ”equals”, the value is the sum of each ”equal”. */
86
int score[13]; /* -1 indicates that target was not reached, otherwise target or max number
92
Rev A, 2006-02-25. First issue.
94
Rev B, 2006-03-20 Updated issue.
96
Rev C, 2006-03-28 Updated issue. Addition of the SolveBoard parameter ”mode”.
98
Rev D, 2006-04-05 Updated issue. Usage of target=0 to list all cards that are legal to play.
100
Rev E, 2006-05-29 Updated issue. New error code –10 for number of cards > 52.
102
Rev F, 2006-08-09 Updated issue. New mode parameter value = 2. New error code –11 for calling SolveBoard with mode = 2 and forbidden values of other parameters.
104
Rev F1, 2006-08-14 Clarifications on conditions for returning scores for the different combinations of the values for target and solutions.
107
Rev F2, 2006-08-26 New error code –12 for wrongly set values of deal.currentTrickSuit and
108
deal.currentTrickRank.
110
Rev G, 2007-01-04 New DDS release 1.1, otherwise no change compared to isse F2.
112
Rev H, 2007-04-23 DDS release 1.4, changes for parameter mode=2.
b'\\ No newline at end of file'