51
51
\par }{\fs20\cf1\lang1053 int first; /* 0-3, 0=North, 1=East, 2=South, 3=West , Leading hand for the trick.*/}{\f0\fs20\cf1\lang1053
52
52
\par }{\fs20\cf1\lang1053 int currentTrickSuit[3]; /* 0-2 for up to 3 cards in the order played */
53
53
\par int currentTrickRank[3]; /* 2-14 for up to 3 cards */}{\f0\fs20\cf1\lang1053
54
\par }{\fs20\cf1\lang1053 unsigned int remainCards[4][4]; /* 1}{\fs20\cf1\lang1053\super st}{\fs20\cf1\lang1053 index hand (0-3), 2}{\fs20\cf1\lang1053\super nd}{\fs20\cf1\lang1053 in
55
dex suit (0-3), values as bitstring of ranks bit 0=0, bit 1=0, bit 2=rank 2, \'85\'85\'85. bit 14=rank 14, bit 15=0}{\f0\fs20\cf1\lang1053 }{\fs20\cf1\lang1053
56
for cards remaining after already played cards (cards already played to the current trick are not included in this bitstring). \line The decimal value for a card then range between 4 (=rank 2) and 16384 (Ace=rank 14). */}{\f0\fs20\cf1\lang1053
54
\par }{\fs20\cf1\lang1053 unsigned int remainCards[4][4]; /* 1}{\fs20\cf1\lang1053\super st}{\fs20\cf1\lang1053 index hand (0-3), 2}{\fs20\cf1\lang1053\super nd}{\fs20\cf1\lang1053
55
index suit (0-3), values as bitstring of ranks bit 0=0, bit 1=0, bit 2=rank 2, \'85\'85\'85. bit 14=rank 14, bit 15=0}{\f0\fs20\cf1\lang1053 }{\fs20\cf1\lang1053 for cards remaining after already played cards (cards alread
56
y played to the current trick are not included in this bitstring). \line The decimal value for a card then range between 4 (=rank 2) and 16384 (Ace=rank 14). */}{\f0\fs20\cf1\lang1053
57
57
\par }{\fs20\cf1\lang1053 \};}{\f0\fs20\cf1\lang1053 }{\fs20\cf1\lang1053
59
59
\par Parameter \'94}{\b\fs20\cf1\lang1053 target}{\fs20\cf1\lang1053 \'94 is the number of tricks to be won by the side to play, -1 means that the program}{\f0\fs20\cf1\lang1053 }{\fs20\cf1\lang1053
61
61
\par \line Parameter \'94}{\b\fs20\cf1\lang1053 solutions}{\fs20\cf1\lang1053 \'94 defines how many card solutions that SolveBoard must return:
62
62
\par target=1-13, solutions=1: Returns only one of the cards. Its returned score is the same as target whentarget or higher tricks can be won. Otherwise, score \endash 1 is returned if target cannot be reached, or score 0 if no tricks can be won. \line
63
63
target=-1, solutions=1: Returns only one of the optimum cards and its score.
64
\par }{\fs20\lang1053 target=0, solutions=1: Returns only one of the cards legal to play with score set to 0.}{\fs20\cf1\lang1053 \line target 1-13,
65
solutions=2: Return all cards meeting target. Their returned scores are the same as target when target or higher tricks can be won. Otherwise, only one card is returned with score \endash
64
\par }{\fs20\lang1053 target=0, solutions=1: Returns only one of the cards legal to play with score set to 0.}{\fs20\cf1\lang1053 \line
65
target 1-13, solutions=2: Return all cards meeting target. Their returned scores are the same as target when target or higher tricks can be won. Otherwise, only one card is returned with score \endash
66
66
1 if target cannot be reached, or score 0 for all cards legal to play if no tricks can be won.\line target \endash 1, solutions=2: Return all optimum cards with their scores.
67
\par }{\fs20\lang1053 target=0, solutions=2: Return all cards legal to play with scores set to 0}{\fs20\cf6\lang1053 .}{\fs20\cf1\lang1053 \line target irrelevant, solutions=3: Return all cards that can be legally played with
68
their scores in descending order.
67
\par }{\fs20\lang1053 target=0, solutions=2: Return all cards legal to play with scores set to 0}{\fs20\cf6\lang1053 .}{\fs20\cf1\lang1053 \line
68
target irrelevant, solutions=3: Return all cards that can be legally played with their scores in descending order.
70
\par Parameter \'94}{\b\fs20\cf1\lang1053 mode}{\fs20\cf1\lang1053 \'94
71
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 equivalent, this mo
72
de determines whether or not the DLL will search to find the score.\line mode=0: Do not search to find the score if the hand to play has only one card, including its equivalents, to play. Score is set to \endash
73
2 for this card, indicating that there are no alternative cards. This mode is very fast but you don\rquote t
74
\par mode=1: Always }{\fs20 search to find the score. Even when the hand to play has only one card, with possible equivalents, to play. For both mode=0 and mode=1: If the preceding SolveBoard call had the same tru
75
mp suit and the same or similar deal, except for deal.first, then the transposition table contents is reused from the preceding SolveBoard call. Setting mode=2 is no longer needed, but can still be done for backwards
76
\par compatibility.\line mode=2: As for mode=1, but the transposition table contents is reused from the preceding SolveBoard call. Deal must be the same, except for deal.first. Trump suit must be the same. Example:
77
\par }\pard \fi720\nowidctlpar\adjustright {\fs20 1}{\fs20\super st}{\fs20 call: SolveBoard(deal, -1, 1, 1, &fut), deal.first=1, i.e. East leads.
78
\par }\pard \nowidctlpar\adjustright {\fs20 \tab 2}{\fs20\super nd}{\fs20 call: SolveBoard(deal, -1, 1, 2, &fut), deal.first=2, i.e. South leads.
79
\par \tab 3rd call: SolveBoard(deal, -1, 1, 2, &fut), deal.first=3, i.e. West leads.
80
\par }\pard \fi720\nowidctlpar\adjustright {\fs20 4th call: SolveBoard(deal, -1, 1, 2, &fut), deal.first=0, i.e. North leads. }{\fs20\cf1\lang1053
70
\par Parameter \'94}{\b\fs20\cf1\lang1053 mode}{\fs20\cf1\lang1053 \'94 defines the DLL mode of operation.\line mode=0: Do not search to find the score if the hand to play has only one card, including its equivalents, to play. Score is set to \endash
71
2 for this card, indicating that there are no alternative cards. If there are multiple choices for cards to play, search is done to find the score. This mode is very fast but you don\rquote t
72
\par mode=1: Always }{\fs20 search to find
73
the score. Even when the hand to play has only one card, with possible equivalents, to play. For both mode=0 and mode=1: If the preceding SolveBoard call had the same trump suit and the same deal, except for deal.first, then the transposition table cont
74
ents is reused from the preceding SolveBoard call. Setting mode=2 is no longer needed in this case, but can still be done for backwards compatibility.\line
75
mode=2: As for mode=1, but the transposition table contents is reused from the preceding SolveBoard call. It is the responsibility of the programmer using the DLL to ensure that reusing the table is safe in the actual situation. Example
76
: Deal is the same, except for deal.first. Trump suit is the same.
77
\par }\pard \fi720\nowidctlpar\adjustright {\fs20 1}{\fs20\super st}{\fs20 call: SolveBoard(deal, -1, 1, 1, &fut, 0), deal.first=1, i.e. East leads.
78
\par }\pard \nowidctlpar\adjustright {\fs20 \tab 2}{\fs20\super nd}{\fs20 call: SolveBoard(deal, -1, 1, 2, &fut, 0), deal.first=2, i.e. South leads.
79
\par \tab 3rd call: SolveBoard(deal, -1, 1, 2, &fut, 0), deal.first=3, i.e. West leads.
80
\par }\pard \fi720\nowidctlpar\adjustright {\fs20 4th call: SolveBoard(deal, -1, 1, 2, &fut, 0), deal.first=0, i.e. North leads. }{\fs20\cf1\lang1053
81
81
\par }\pard \nowidctlpar\adjustright {\fs20\cf1\lang1053
82
82
\par struct }{\b\fs20\cf1\lang1053 futureTricks}{\fs20\cf1\lang1053 \{ /* The DLL provides the score (number of tricks) that can be won by the card to play defined by its suit and rank. Array of all alternative cards. */}{\f0\fs20\cf1\lang1053
83
83
\par }{\fs20\cf1\lang1053 int nodes; /* Number of searched nodes */