-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5f151c1
Showing
11 changed files
with
8,491 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
{\rtf1\ansi\ansicpg1252\uc1 \deff1\deflang1033\deflangfe1053{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;} | ||
{\f93\froman\fcharset238\fprq2 Times New Roman CE;}{\f94\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f96\froman\fcharset161\fprq2 Times New Roman Greek;}{\f97\froman\fcharset162\fprq2 Times New Roman Tur;} | ||
{\f98\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f99\fswiss\fcharset238\fprq2 Arial CE;}{\f100\fswiss\fcharset204\fprq2 Arial Cyr;}{\f102\fswiss\fcharset161\fprq2 Arial Greek;}{\f103\fswiss\fcharset162\fprq2 Arial Tur;} | ||
{\f104\fswiss\fcharset186\fprq2 Arial Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128; | ||
\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\nowidctlpar\adjustright \f1\cgrid \snext0 Normal;}{ | ||
\s1\nowidctlpar\outlinelevel0\adjustright \f1\cgrid \sbasedon0 \snext0 heading 1;}{\*\cs10 \additive Default Paragraph Font;}{\*\cs15 \additive \b \sbasedon10 Strong;}}{\info{\title Bo Haglund, Bob Richardson}{\author Bo Haglund}{\operator Bo Haglund} | ||
{\creatim\yr2007\mo4\dy23\hr19\min18}{\revtim\yr2007\mo4\dy23\hr19\min45}{\version5}{\edmins18}{\nofpages3}{\nofwords904}{\nofchars5154}{\*\company }{\nofcharsws0}{\vern89}}\margl1417\margr1417\margt1417\margb1417 | ||
\widowctrl\ftnbj\aenddoc\hyphhotz425\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\viewkind4\viewscale100 \fet0\sectd \linex0\headery709\footery709\colsx709\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}} | ||
{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}} | ||
{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9 | ||
\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \nowidctlpar\adjustright \f1\cgrid {\fs20\lang1053 Bo Haglund, Bob Richardson | ||
\par Rev H, 2007-04-23 | ||
\par | ||
\par | ||
\par }{\b\fs20\cf1\lang1053 Short description of the DLL functions supported in Double Dummy Problem Solver 1.1}{\fs20\cf1\lang1053 | ||
\par | ||
\par | ||
\par extern "C" __declspec(dllimport) int __stdcall SolveBoard(struct deal, int target, | ||
\par int solutions, int mode, struct futureTricks *futp); | ||
\par | ||
\par /* Before SolveBoard can be called, a structure of type "futureTricks" must be declared. | ||
\par | ||
\par }{\b\fs20\cf1\lang1053 SolveBoard}{\fs20\cf1\lang1053 returns a status integer, "no fault" means the DLL supplies the trick data in the\line "futureTricks" type structure.\line Status codes: | ||
\par 1=No fault, | ||
\par -1=Unknown fault, | ||
\par -2=No of cards = 0, | ||
\par -3=target > Number of tricks left, | ||
\par -4=Duplicated cards, | ||
\par -5=target < -1, | ||
\par -7=target >13, | ||
\par -8=solutions < 1, | ||
\par -9=solutions > 3, | ||
\par -10=No of cards > 52 | ||
\par -11=Not used | ||
\par -12=Suit or rank value out of range for deal.currentTrickSuit or deal.currentTrickRank.\line \line Structure \'94}{\b\fs20\cf1\lang1053 deal}{\fs20\cf1\lang1053 \'94 defines all data needed to describe the deal to be analyzed. | ||
\par struct deal \{}{\f0\fs20\cf1\lang1053 | ||
\par }{\fs20\cf1\lang1053 int trump; /* I.e. which suit that is trump or if contract is NT, Spades=0, Hearts=1, \line Diamonds=2, Clubs=3, NT=4 */}{\f0\fs20\cf1\lang1053 | ||
\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 | ||
\par }{\fs20\cf1\lang1053 int currentTrickSuit[3]; /* 0-3 for up to 3 cards in the order played */ | ||
\par int currentTrickRank[3]; /* 2-14 for up to 3 cards */}{\f0\fs20\cf1\lang1053 | ||
\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 index suit (0-3), values as bitstring of ranks\line \tab \tab \tab \tab | ||
bit 0=0, bit 1=0, bit 2=rank 2, \'85\'85\'85. bit 14=rank 14, bit 15=0}{\f0\fs20\cf1\lang1053 | ||
\par }\pard \li2880\nowidctlpar\adjustright {\fs20\cf1\lang1053 for cards remaining after already played cards (cards already \line 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 | ||
\par 16384 (Ace=rank 14). */}{\f0\fs20\cf1\lang1053 | ||
\par }\pard \nowidctlpar\adjustright {\fs20\cf1\lang1053 \};}{\f0\fs20\cf1\lang1053 }{\fs20\cf1\lang1053 | ||
\par | ||
\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 | ||
\par }{\fs20\cf1\lang1053 shall find the maximum number. For equivalent cards only the highest is returned. | ||
\par \line Parameter \'94}{\b\fs20\cf1\lang1053 solutions}{\fs20\cf1\lang1053 \'94 defines how many card solutions that SolveBoard must return: | ||
\par target=1-13, solutions=1: Returns only one of the cards. Its returned score is the same as target when \line target or higher tricks can be won. Otherwise, score \endash 1 is returned if target \line | ||
cannot be reached, or score 0 if no tricks can be won. \line target=-1, solutions=1: Returns only one of the optimum cards and its score. | ||
\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, solutions=2: Return all cards meeting target. Their returned scores are the same as\line | ||
target when target or higher tricks can be won. Otherwise, only one card \line is returned with score \endash 1 if target cannot be reached, or score 0 for all cards \line | ||
legal to play if no tricks can be won.\line target \endash 1, solutions=2: Return all optimum cards with their scores. | ||
\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 their scores in | ||
\par descending order. | ||
\par | ||
\par Parameter \'94}{\b\fs20\cf1\lang1053 mode}{\fs20\cf1\lang1053 \'94 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 | ||
|
||
\par equivalent, this mode 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, | ||
\par to play. Score is set to \endash 2 for this card, indicating that there are no alternative cards. This mode | ||
\par is very fast but you don\rquote t | ||
\par mode=1: Always }{\fs20 search to find the score. Even when the hand to play has only one card, with possible | ||
\par equivalents, to play.\line mode=2: As for mode=1, but the transposition table contents is reused from the preceding SolveBoard\line call. Deal must be the same, except for deal.first. | ||
\par Example: | ||
\par 1}{\fs20\super st}{\fs20 call: SolveBoard(deal, -1, 1, 1, &fut), deal.first=1, i.e. East leads. | ||
\par }{\fs20 2}{\fs20\super nd}{\fs20 call: SolveBoard(deal, }{\fs20 -1}{\fs20 , 1, 2, &fut), deal.first=}{\fs20 2}{\fs20 , i.e. }{\fs20 South}{\fs20 leads.}{\fs20 | ||
\par 3rd call: SolveBoard(deal, -1, 1, 2, &fut), deal.first=3, i.e. West leads. | ||
\par 4th}{\fs20 call: SolveBoard(deal, }{\fs20 -1}{\fs20 , 1, 2, &fut), deal.first=}{\fs20 0}{\fs20 , i.e. }{\fs20 North}{\fs20 leads. }{\fs20 }{\fs20\cf1\lang1053 | ||
\par | ||
\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 | ||
\par \tab play defined by its suit and rank. Array of all alternative cards. */}{\f0\fs20\cf1\lang1053 | ||
\par }{\fs20\cf1\lang1053 int nodes; /* Number of searched nodes */ | ||
\par int cards; /* No of alternative cards */}{\f0\fs20\cf1\lang1053 | ||
\par }{\fs20\cf1\lang1053 int suit[13]; /* 0=Spades, 1=Hearts, 2=Diamonds, 3=Clubs */ | ||
\par int rank[13]; /* 2-14 for 2 through Ace *}{\b\fs20\cf1\lang1053 / | ||
\par }{\fs20\cf1\lang1053 int equals[13]; /* Bitstring of ranks for equivalent lower rank cards. | ||
\par }\pard \li1440\nowidctlpar\adjustright {\fs20\cf1\lang1053 The decimal value range between 4 (=2) and 8192 (King=rank 13). When there\line are several \'94equals\'94, the value is the sum of each \'94equal\'94. *}{\b\fs20\cf1\lang1053 /}{ | ||
\fs20\cf1\lang1053 | ||
\par }\pard \nowidctlpar\adjustright {\fs20\cf1\lang1053 int score[13]; /* -1 indicates that target was not reached, otherwise target or max number}{\f0\fs20\cf1\lang1053 | ||
\par }{\fs20\cf1\lang1053 of tricks */}{\f0\fs20\cf1\lang1053 | ||
\par }{\fs20\cf1\lang1053 \} ; }{\f0\fs20\cf1\lang1053 | ||
\par }\pard\plain \s1\keepn\nowidctlpar\outlinelevel0\adjustright \f1\cgrid {\b\fs20\cf1\lang1053 | ||
\par Revision History | ||
\par }\pard\plain \nowidctlpar\adjustright \f1\cgrid {\fs20\cf1\lang1053 | ||
\par Rev A, 2006-02-25.\tab \tab First issue. | ||
\par | ||
\par Rev B, 2006-03-20\tab \tab Updated issue. | ||
\par | ||
\par }\pard \fi-2880\li2880\nowidctlpar\adjustright {\fs20\cf1\lang1053 Rev C, 2006-03-28\tab Updated issue. Addition of the SolveBoard parameter \'94mode\'94. | ||
\par | ||
\par Rev D, 2006-04-05\tab Updated issue. Usage of target=0 to list all cards that are legal to play. | ||
\par | ||
\par Rev E, 2006-05-29\tab Updated issue. New error code \endash 10 for number of cards > 52. | ||
\par | ||
\par Rev F, 2006-08-09\tab Updated issue. New mode parameter value = 2. New error code \endash 11 for calling SolveBoard with mode = 2 and forbidden values of other parameters. | ||
\par }\pard \nowidctlpar\adjustright {\fs20\cf1\lang1053 | ||
\par }\pard \fi-2880\li2880\nowidctlpar\adjustright {\fs20\cf1\lang1053 Rev F1, 2006-08-14\tab Clarifications on conditions for returning scores for the different combinations of the values for target and solutions. | ||
\par | ||
\par | ||
\par Rev F2, 2006-08-26\tab New error code \endash 12 for wrongly set values of deal.currentTrickSuit and\line deal.currentTrickRank. | ||
\par | ||
\par Rev G, 2007-01-04\tab New DDS release 1.1, otherwise no change compared to isse F2. | ||
\par | ||
\par Rev H}{\fs20\cf1\lang1053 , 2007-}{\fs20\cf1\lang1053 04}{\fs20\cf1\lang1053 -}{\fs20\cf1\lang1053 23}{\fs20\cf1\lang1053 \tab DDS release 1.}{\fs20\cf1\lang1053 4}{\fs20\cf1\lang1053 , }{\fs20\cf1\lang1053 changes for parameter mode=2}{ | ||
\fs20\cf1\lang1053 .}{\fs20\cf1\lang1053 | ||
\par }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
Bo Haglund, Bob Richardson | ||
Rev H, 2007-04-23 | ||
|
||
|
||
Short description of the DLL functions supported in Double Dummy Problem Solver 1.1 | ||
|
||
|
||
extern "C" __declspec(dllimport) int __stdcall SolveBoard(struct deal, int target, | ||
int solutions, int mode, struct futureTricks *futp); | ||
|
||
/* Before SolveBoard can be called, a structure of type "futureTricks" must be declared. | ||
|
||
SolveBoard returns a status integer, "no fault" means the DLL supplies the trick data in the | ||
"futureTricks" type structure. | ||
Status codes: | ||
1=No fault, | ||
-1=Unknown fault, | ||
-2=No of cards = 0, | ||
-3=target > Number of tricks left, | ||
-4=Duplicated cards, | ||
-5=target < -1, | ||
-7=target >13, | ||
-8=solutions < 1, | ||
-9=solutions > 3, | ||
-10=No of cards > 52 | ||
-11=Not used | ||
-12=Suit or rank value out of range for deal.currentTrickSuit or deal.currentTrickRank. | ||
|
||
Structure ”deal” defines all data needed to describe the deal to be analyzed. | ||
struct deal { | ||
int trump; /* I.e. which suit that is trump or if contract is NT, Spades=0, Hearts=1, | ||
Diamonds=2, Clubs=3, NT=4 */ | ||
int first; /* 0-3, 0=North, 1=East, 2=South, 3=West , Leading hand for the trick.*/ | ||
int currentTrickSuit[3]; /* 0-3 for up to 3 cards in the order played */ | ||
int currentTrickRank[3]; /* 2-14 for up to 3 cards */ | ||
unsigned int remainCards[4][4]; /* 1st index hand (0-3), 2nd index suit (0-3), values as bitstring of ranks | ||
bit 0=0, bit 1=0, bit 2=rank 2, ………. bit 14=rank 14, bit 15=0 | ||
for cards remaining after already played cards (cards already | ||
played to the current trick are not included in this bitstring). | ||
The decimal value for a card then range between 4 (=rank 2) and | ||
16384 (Ace=rank 14). */ | ||
}; | ||
|
||
Parameter ”target” is the number of tricks to be won by the side to play, -1 means that the program | ||
shall find the maximum number. For equivalent cards only the highest is returned. | ||
|
||
Parameter ”solutions” defines how many card solutions that SolveBoard must return: | ||
target=1-13, solutions=1: Returns only one of the cards. Its returned score is the same as target when | ||
target or higher tricks can be won. Otherwise, score –1 is returned if target | ||
cannot be reached, or score 0 if no tricks can be won. | ||
target=-1, solutions=1: Returns only one of the optimum cards and its score. | ||
target=0, solutions=1: Returns only one of the cards legal to play with score set to 0. | ||
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 –1 if target cannot be reached, or score 0 for all cards | ||
legal to play if no tricks can be won. | ||
target –1, solutions=2: Return all optimum cards with their scores. | ||
target=0, solutions=2: Return all cards legal to play with scores set to 0. | ||
target irrelevant, solutions=3: Return all cards that can be legally played with their scores in | ||
descending order. | ||
|
||
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 | ||
equivalent, this mode determines whether or not the DLL will search to find the score. | ||
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 –2 for this card, indicating that there are no alternative cards. This mode | ||
is very fast but you don’t | ||
mode=1: Always search to find the score. Even when the hand to play has only one card, with possible | ||
equivalents, to play. | ||
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. | ||
Example: | ||
1st call: SolveBoard(deal, -1, 1, 1, &fut), deal.first=1, i.e. East leads. | ||
2nd call: SolveBoard(deal, -1, 1, 2, &fut), deal.first=2, i.e. South leads. | ||
3rd call: SolveBoard(deal, -1, 1, 2, &fut), deal.first=3, i.e. West leads. | ||
4th call: SolveBoard(deal, -1, 1, 2, &fut), deal.first=0, i.e. North leads. | ||
|
||
struct futureTricks { /* 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. */ | ||
int nodes; /* Number of searched nodes */ | ||
int cards; /* No of alternative cards */ | ||
int suit[13]; /* 0=Spades, 1=Hearts, 2=Diamonds, 3=Clubs */ | ||
int rank[13]; /* 2-14 for 2 through Ace */ | ||
int equals[13]; /* Bitstring of ranks for equivalent lower rank cards. | ||
The decimal value range between 4 (=2) and 8192 (King=rank 13). When there | ||
are several ”equals”, the value is the sum of each ”equal”. */ | ||
int score[13]; /* -1 indicates that target was not reached, otherwise target or max number | ||
of tricks */ | ||
} ; | ||
|
||
Revision History | ||
|
||
Rev A, 2006-02-25. First issue. | ||
|
||
Rev B, 2006-03-20 Updated issue. | ||
|
||
Rev C, 2006-03-28 Updated issue. Addition of the SolveBoard parameter ”mode”. | ||
|
||
Rev D, 2006-04-05 Updated issue. Usage of target=0 to list all cards that are legal to play. | ||
|
||
Rev E, 2006-05-29 Updated issue. New error code –10 for number of cards > 52. | ||
|
||
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. | ||
|
||
Rev F1, 2006-08-14 Clarifications on conditions for returning scores for the different combinations of the values for target and solutions. | ||
|
||
|
||
Rev F2, 2006-08-26 New error code –12 for wrongly set values of deal.currentTrickSuit and | ||
deal.currentTrickRank. | ||
|
||
Rev G, 2007-01-04 New DDS release 1.1, otherwise no change compared to isse F2. | ||
|
||
Rev H, 2007-04-23 DDS release 1.4, changes for parameter mode=2. |
Oops, something went wrong.