1
/* portability-macros header prefix */
3
/* Windows requires a __declspec(dllexport) tag, etc */
5
# define DLLEXPORT __declspec(dllexport)
6
# define STDCALL __stdcall
14
# define EXTERN_C extern "C"
19
#if defined(_WIN32) && defined(__MINGW32__)
20
#define WINVER 0x500 /* Dirty trick, but it works. */
25
#if defined(_WIN32) && !defined(__MINGW32__)
40
/* end of portability-macros section */
42
#define DDS_VERSION 20402 /* Version 2.4.2. Allowing for 2 digit
52
/*#define _CRTDBG_MAP_ALLOC */ /* MEMORY LEAK? */
54
/*#include <crtdbg.h> */ /* MEMORY LEAK? */
61
typedef long long __int64;
64
/*#define STAT*/ /* Define STAT to generate a statistics log, stat.txt */
65
/*#define TTDEBUG*/ /* Define TTDEBUG to generate transposition table debug information.
66
Only for a single thread! */
69
#define SEARCHSIZE 20000
77
#define INFINITY 32000
79
#define MAXNOOFTHREADS 16
97
#define SIMILARDEALLIMIT 5
98
#define SIMILARMAXWINNODES 700000
100
#define MAXNOOFBOARDS 200/*100*/
102
#define Max(x, y) (((x) >= (y)) ? (x) : (y))
103
#define Min(x, y) (((x) <= (y)) ? (x) : (y))
105
/* "hand" is leading hand, "relative" is hand relative leading
107
The handId macro implementation follows a solution
109
All hand identities are given as
110
0=NORTH, 1=EAST, 2=SOUTH, 3=WEST. */
112
#define handId(hand, relative) (hand + relative) & 3
113
#define CMP_SWAP(i, j) if (a[i].weight < a[j].weight) \
114
{ struct moveType tmp = a[i]; a[i] = a[j]; a[j] = tmp; }
117
struct gameInfo { /* All info of a particular deal */
124
unsigned short int suit[4][4];
125
/* 1st index is hand id, 2nd index is suit id */
132
unsigned short int sequence; /* Whether or not this move is
133
the first in a sequence */
134
short int weight; /* Weight used at sorting */
138
struct moveType move[14];
143
struct highCardType {
148
struct futureTricks {
163
int currentTrickSuit[3];
164
int currentTrickRank[3];
165
unsigned int remainCards[4][4];
172
int currentTrickSuit[3];
173
int currentTrickRank[3];
174
char remainCards[80];
179
unsigned short int rankInSuit[4][4]; /* 1st index is hand, 2nd index is
185
unsigned short int removedRanks[4]; /* Ranks removed from board,
187
unsigned short int winRanks[50][4]; /* Cards that win by rank,
188
indices are depth and suit */
189
unsigned char length[4][4];
194
int first[50]; /* Hand that leads the trick for each ply*/
195
int high[50]; /* Hand that is presently winning the trick */
196
struct moveType move[50]; /* Presently winning move */
197
int handRelFirst; /* The current hand, relative first hand */
198
int tricksMAX; /* Aggregated tricks won by MAX */
199
struct highCardType winner[4]; /* Winning rank of the trick,
201
struct highCardType secondBest[4]; /* Second best rank, index is suit id. */
204
struct posSearchType {
205
struct winCardType * posSearchPoint;
206
long long suitLengths;
207
struct posSearchType * left;
208
struct posSearchType * right;
212
struct nodeCardsType {
213
char ubound; /* ubound and
214
lbound for the N-S side */
224
struct nodeCardsType * first;
225
struct winCardType * prevWin;
226
struct winCardType * nextWin;
227
struct winCardType * next;
233
unsigned short int winRanks[4];
241
struct relRanksType {
245
struct absRankType absRank[15][4];
248
struct adaptWinRanksType {
249
unsigned short int winRanks[14];
254
struct nodeCardsType * cardsP;
260
unsigned short int suit[4][4];
270
struct deal deals[MAXNOOFBOARDS];
271
int target[MAXNOOFBOARDS];
272
int solutions[MAXNOOFBOARDS];
273
int mode[MAXNOOFBOARDS];
278
struct dealPBN deals[MAXNOOFBOARDS];
279
int target[MAXNOOFBOARDS];
280
int solutions[MAXNOOFBOARDS];
281
int mode[MAXNOOFBOARDS];
284
struct solvedBoards {
286
struct futureTricks solvedBoard[MAXNOOFBOARDS];
292
struct solvedBoards *solvedp;
297
unsigned int cards[4][4];
300
struct ddTableDeals {
302
struct ddTableDeal deals[MAXNOOFBOARDS>>2];
305
struct ddTableDealPBN {
309
struct ddTableDealsPBN {
311
struct ddTableDealPBN deals[MAXNOOFBOARDS>>2];
314
struct ddTableResults {
320
struct ddTableResults results[MAXNOOFBOARDS>>2];
325
char parScore[2][16]; /* index = 0 is NS view and index = 1 is EW view. */
326
char parContractsString[2][128]; /* index = 0 is NS view and index = 1
327
is EW view. By �view� is here meant
328
which side that starts the bidding. */
332
struct allParResults {
333
struct parResults presults[MAXNOOFBOARDS / 20];
336
struct par_suits_type {
343
struct localVarType {
344
int nodeTypeStore[4];
346
unsigned short int lowestWin[50][4];
354
struct pos iniPosition;
355
struct pos lookAheadPos; /* Is initialized for starting
357
struct moveType forbiddenMoves[14];
358
struct moveType initialMoves[4];
360
struct movePlyType movePly[50];
362
struct gameInfo game;
366
unsigned short int diffDeal;
367
unsigned short int aggDeal;
373
struct moveType bestMove[50];
374
struct moveType bestMoveTT[50];
375
struct winCardType temp_win[5];
376
int nodeSetSizeLimit;
379
unsigned long long maxmem; /* bytes */
380
unsigned long long allocmem;
381
unsigned long long summem;
393
struct relRanksType * rel;
394
struct adaptWinRanksType * adaptWins;
395
struct posSearchType *rootnp[14][4];
396
struct winCardType **pw;
397
struct nodeCardsType **pn;
398
struct posSearchType **pl;
399
struct nodeCardsType * nodeCards;
400
struct winCardType * winCards;
401
struct posSearchType * posSearch;
402
/*struct ttStoreType * ttStore;
404
unsigned short int iniRemovedRanks[4];
406
int nodeSetSize; /* Index with range 0 to nodeSetSizeLimit */
407
int winSetSize; /* Index with range 0 to winSetSizeLimit */
408
int lenSetSize; /* Index with range 0 to lenSetSizeLimit */
411
extern int noOfThreads;
412
extern int noOfCores;
413
extern struct localVarType localVar[MAXNOOFTHREADS];
414
extern int * highestRank;
415
extern int * counttable;
416
extern struct adaptWinRanksType * adaptWins;
417
extern unsigned short int bitMapRank[16];
418
extern unsigned short int relRankInSuit[4][4];
420
extern int score1Counts[50], score0Counts[50];
421
extern int c1[50], c2[50], c3[50], c4[50], c5[50], c6[50], c7[50],
423
extern int nodeTypeStore[4]; /* Look-up table for determining if
424
node is MAXNODE or MINNODE */
425
extern int lho[4], rho[4], partner[4];
426
extern int nodes; /* Number of nodes searched */
427
extern int no[50]; /* Number of nodes searched on each
431
extern int treeDepth;
432
extern int tricksTarget; /* No of tricks for MAX in order to
433
meet the game goal, e.g. to make the
435
extern int tricksTargetOpp; /* Target no of tricks for MAX
439
extern int handToPlay;
440
extern int searchTraceFlag;
442
extern int depthCount;
444
extern int nodeSetSizeLimit;
445
extern int winSetSizeLimit;
446
extern int lenSetSizeLimit;
447
extern int estTricks[4];
449
extern int suppressTTlog;
450
extern unsigned char suitChar[4];
451
extern unsigned char rankChar[15];
452
extern unsigned char handChar[4];
453
extern unsigned char cardRank[15], cardSuit[5], cardHand[4];
454
extern int totalNodes;
455
extern struct futureTricks fut, ft;
456
extern struct futureTricks *futp;
457
extern char stri[128];
459
extern FILE *fp, /**fp2, *fp7, *fp11,*/ *fpx;
460
/* Pointers to logs */
462
extern struct ttStoreType * ttStore;
463
extern int lastTTstore;
464
extern int ttCollect;
465
extern int suppressTTlog;
467
EXTERN_C DLLEXPORT int STDCALL SolveBoard(struct deal dl,
468
int target, int solutions, int mode, struct futureTricks *futp, int threadIndex);
469
EXTERN_C DLLEXPORT int STDCALL CalcDDtable(struct ddTableDeal tableDeal,
470
struct ddTableResults * tablep);
473
EXTERN_C DLLEXPORT int STDCALL SolveBoardPBN(struct dealPBN dlpbn, int target,
474
int solutions, int mode, struct futureTricks *futp, int thrId);
475
EXTERN_C DLLEXPORT int STDCALL CalcDDtablePBN(struct ddTableDealPBN tableDealPBN,
476
struct ddTableResults * tablep);
480
EXTERN_C DLLEXPORT int STDCALL SolveAllBoards(struct boardsPBN *bop, struct solvedBoards *solvedp);
481
EXTERN_C DLLEXPORT int STDCALL CalcAllTables(struct ddTableDeals *dealsp, int mode,
482
int trumpFilter[5], struct ddTablesRes *resp, struct allParResults *presp);
483
EXTERN_C DLLEXPORT int STDCALL CalcAllTablesPBN(struct ddTableDealsPBN *dealsp, int mode,
484
int trumpFilter[5], struct ddTablesRes *resp, struct allParResults *presp);
485
EXTERN_C DLLEXPORT int STDCALL CalcPar(struct ddTableDeal tableDeal, int vulnerable,
486
struct ddTableResults * tablep, struct parResults *presp);
487
EXTERN_C DLLEXPORT int STDCALL CalcParPBN(struct ddTableDealPBN tableDealPBN,
488
struct ddTableResults * tablep, int vulnerable, struct parResults *presp);
492
EXTERN_C void InitStart(int gb_ram, int ncores); /* For usage with ctypes in Linux. */
495
EXTERN_C void InitStart(int gb_ram, int ncores);
496
void InitGame(int gameNo, int moveTreeFlag, int first, int handRelFirst, int thrId);
497
void InitSearch(struct pos * posPoint, int depth,
498
struct moveType startMoves[], int first, int mtd, int thrId);
499
int ABsearch(struct pos * posPoint, int target, int depth, int thrId);
500
void Make(struct pos * posPoint, unsigned short int trickCards[4],
501
int depth, int trump, struct movePlyType *mply, int thrId);
502
int MoveGen(struct pos * posPoint, int depth, int trump, struct movePlyType *mply, int thrId);
503
void MergeSort(int n, struct moveType *a);
504
inline int WinningMove(struct moveType * mvp1, struct moveType * mvp2, int trump, int thrId);
505
inline int WinningMoveNT(struct moveType * mvp1, struct moveType * mvp2, int thrId);
506
int AdjustMoveList(int thrId);
507
int QuickTricks(struct pos * posPoint, int hand,
508
int depth, int target, int trump, int *result, int thrId);
509
int LaterTricksMIN(struct pos *posPoint, int hand, int depth, int target, int trump, int thrId);
510
int LaterTricksMAX(struct pos *posPoint, int hand, int depth, int target, int trump, int thrId);
511
struct nodeCardsType * CheckSOP(struct pos * posPoint, struct nodeCardsType
512
* nodep, int target, int tricks, int * result, int *value, int thrId);
513
struct nodeCardsType * UpdateSOP(struct pos * posPoint, struct nodeCardsType
515
struct nodeCardsType * FindSOP(struct pos * posPoint,
516
struct winCardType * nodeP, int firstHand,
517
int target, int tricks, int * valp, int thrId);
518
struct nodeCardsType * BuildPath(struct pos * posPoint,
519
struct posSearchType *nodep, int * result, int thrId);
520
void BuildSOP(struct pos * posPoint, int tricks, int firstHand, int target,
521
int depth, int scoreFlag, int score, int thrId);
522
struct posSearchType * SearchLenAndInsert(struct posSearchType
523
* rootp, long long key, int insertNode, int *result, int thrId);
524
void Undo(struct pos * posPoint, int depth, struct movePlyType *mply, int thrId);
525
int CheckDeal(struct moveType * cardp, int thrId);
526
int InvBitMapRank(unsigned short bitMap);
527
int InvWinMask(int mask);
528
void ReceiveTTstore(struct pos *posPoint, struct nodeCardsType * cardsP, int target,
529
int depth, int thrId);
530
int NextMove(struct pos *posPoint, int depth, struct movePlyType *mply, int thrId);
531
int DumpInput(int errCode, struct deal dl, int target, int solutions, int mode);
532
void Wipe(int thrId);
533
void AddNodeSet(int thrId);
534
void AddLenSet(int thrId);
535
void AddWinSet(int thrId);
537
void PrintDeal(FILE *fp, unsigned short ranks[4][4]);
539
int SolveAllBoards4(struct boards *bop, struct solvedBoards *solvedp);
540
int SolveAllBoards1(struct boards *bop, struct solvedBoards *solvedp);
542
int IsCard(char cardChar);
543
void UpdateDealInfo(int card);
544
int IsVal(char cardChar);
1
/* portability-macros header prefix */
3
/* Windows requires a __declspec(dllexport) tag, etc */
5
# define DLLEXPORT __declspec(dllexport)
6
# define STDCALL __stdcall
14
# define EXTERN_C extern "C"
19
#if defined(_WIN32) && defined(__MINGW32__)
25
#if defined(_WIN32) && !defined(__MINGW32__)
41
/* end of portability-macros section */
43
#define DDS_VERSION 20502 /* Version 2.5.2. Allowing for 2 digit minor versions */
52
/*#define _CRTDBG_MAP_ALLOC */ /* MEMORY LEAK? */
54
/*#include <crtdbg.h> */ /* MEMORY LEAK? */
61
typedef long long __int64;
64
/*#define STAT*/ /* Define STAT to generate a statistics log, stat.txt */
65
/*#define TTDEBUG*/ /* Define TTDEBUG to generate transposition table debug information.
66
Only for a single thread! */
69
#define SEARCHSIZE 20000
77
#define INFINITY 32000
79
#define MAXNOOFTHREADS 16
97
#define SIMILARDEALLIMIT 5
98
#define SIMILARMAXWINNODES 700000
100
#define MAXNOOFBOARDS 200/*100*/
102
#define Max(x, y) (((x) >= (y)) ? (x) : (y))
103
#define Min(x, y) (((x) <= (y)) ? (x) : (y))
105
/* "hand" is leading hand, "relative" is hand relative leading
107
The handId macro implementation follows a solution
109
All hand identities are given as
110
0=NORTH, 1=EAST, 2=SOUTH, 3=WEST. */
112
#define handId(hand, relative) (hand + relative) & 3
113
#define CMP_SWAP(i, j) if (a[i].weight < a[j].weight) \
114
{ struct moveType tmp = a[i]; a[i] = a[j]; a[j] = tmp; }
117
struct gameInfo { /* All info of a particular deal */
124
unsigned short int suit[4][4];
125
/* 1st index is hand id, 2nd index is suit id */
132
unsigned short int sequence; /* Whether or not this move is
133
the first in a sequence */
134
short int weight; /* Weight used at sorting */
138
struct moveType move[14];
143
struct highCardType {
148
struct futureTricks {
163
int currentTrickSuit[3];
164
int currentTrickRank[3];
165
unsigned int remainCards[4][4];
172
int currentTrickSuit[3];
173
int currentTrickRank[3];
174
char remainCards[80];
179
unsigned short int rankInSuit[4][4]; /* 1st index is hand, 2nd index is
185
unsigned short int removedRanks[4]; /* Ranks removed from board,
187
unsigned short int winRanks[50][4]; /* Cards that win by rank,
188
indices are depth and suit */
189
unsigned char length[4][4];
194
int first[50]; /* Hand that leads the trick for each ply*/
195
int high[50]; /* Hand that is presently winning the trick */
196
struct moveType move[50]; /* Presently winning move */
197
int handRelFirst; /* The current hand, relative first hand */
198
int tricksMAX; /* Aggregated tricks won by MAX */
199
struct highCardType winner[4]; /* Winning rank of the trick,
201
struct highCardType secondBest[4]; /* Second best rank, index is suit id. */
204
struct posSearchType {
205
struct winCardType * posSearchPoint;
206
long long suitLengths;
207
struct posSearchType * left;
208
struct posSearchType * right;
212
struct nodeCardsType {
213
char ubound; /* ubound and
214
lbound for the N-S side */
224
struct nodeCardsType * first;
225
struct winCardType * prevWin;
226
struct winCardType * nextWin;
227
struct winCardType * next;
233
unsigned short int winRanks[4];
241
struct relRanksType {
245
struct absRankType absRank[15][4];
248
struct adaptWinRanksType {
249
unsigned short int winRanks[14];
254
struct nodeCardsType * cardsP;
260
unsigned short int suit[4][4];
270
struct deal deals[MAXNOOFBOARDS];
271
int target[MAXNOOFBOARDS];
272
int solutions[MAXNOOFBOARDS];
273
int mode[MAXNOOFBOARDS];
278
struct dealPBN deals[MAXNOOFBOARDS];
279
int target[MAXNOOFBOARDS];
280
int solutions[MAXNOOFBOARDS];
281
int mode[MAXNOOFBOARDS];
284
struct solvedBoards {
286
struct futureTricks solvedBoard[MAXNOOFBOARDS];
292
struct solvedBoards *solvedp;
297
unsigned int cards[4][4];
300
struct ddTableDeals {
302
struct ddTableDeal deals[MAXNOOFBOARDS>>2];
305
struct ddTableDealPBN {
309
struct ddTableDealsPBN {
311
struct ddTableDealPBN deals[MAXNOOFBOARDS>>2];
314
struct ddTableResults {
320
struct ddTableResults results[MAXNOOFBOARDS>>2];
325
char parScore[2][16]; /* index = 0 is NS view and index = 1 is EW view. */
326
char parContractsString[2][128]; /* index = 0 is NS view and index = 1
327
is EW view. By �view� is here meant
328
which side that starts the bidding. */
332
struct allParResults {
333
struct parResults presults[MAXNOOFBOARDS / 20];
336
struct par_suits_type {
343
struct localVarType {
344
int nodeTypeStore[4];
346
unsigned short int lowestWin[50][4];
356
struct pos iniPosition;
357
struct pos lookAheadPos; /* Is initialized for starting
359
struct moveType forbiddenMoves[14];
360
struct moveType initialMoves[4];
362
struct movePlyType movePly[50];
364
struct gameInfo game;
368
unsigned short int diffDeal;
369
unsigned short int aggDeal;
375
struct moveType bestMove[50];
376
struct moveType bestMoveTT[50];
377
struct winCardType temp_win[5];
378
int nodeSetSizeLimit;
381
unsigned long long maxmem; /* bytes */
382
unsigned long long allocmem;
383
unsigned long long summem;
395
struct relRanksType * rel;
396
struct adaptWinRanksType * adaptWins;
397
struct posSearchType *rootnp[14][4];
398
struct winCardType **pw;
399
struct nodeCardsType **pn;
400
struct posSearchType **pl;
401
struct nodeCardsType * nodeCards;
402
struct winCardType * winCards;
403
struct posSearchType * posSearch;
404
/*struct ttStoreType * ttStore;
406
unsigned short int iniRemovedRanks[4];
408
int nodeSetSize; /* Index with range 0 to nodeSetSizeLimit */
409
int winSetSize; /* Index with range 0 to winSetSizeLimit */
410
int lenSetSize; /* Index with range 0 to lenSetSizeLimit */
413
extern int noOfThreads;
414
extern int noOfCores;
415
extern struct localVarType localVar[MAXNOOFTHREADS];
416
extern int * highestRank;
417
extern int * counttable;
418
extern struct adaptWinRanksType * adaptWins;
419
extern unsigned short int bitMapRank[16];
420
extern unsigned short int relRankInSuit[4][4];
422
extern int score1Counts[50], score0Counts[50];
423
extern int c1[50], c2[50], c3[50], c4[50], c5[50], c6[50], c7[50],
425
extern int nodeTypeStore[4]; /* Look-up table for determining if
426
node is MAXNODE or MINNODE */
427
extern int lho[4], rho[4], partner[4];
428
extern int nodes; /* Number of nodes searched */
429
extern int no[50]; /* Number of nodes searched on each
433
extern int treeDepth;
434
extern int tricksTarget; /* No of tricks for MAX in order to
435
meet the game goal, e.g. to make the
437
extern int tricksTargetOpp; /* Target no of tricks for MAX
441
extern int handToPlay;
442
extern int searchTraceFlag;
444
extern int depthCount;
446
extern int nodeSetSizeLimit;
447
extern int winSetSizeLimit;
448
extern int lenSetSizeLimit;
449
extern int estTricks[4];
451
extern int suppressTTlog;
452
extern unsigned char suitChar[4];
453
extern unsigned char rankChar[15];
454
extern unsigned char handChar[4];
455
extern unsigned char cardRank[15], cardSuit[5], cardHand[4];
456
extern int totalNodes;
457
extern struct futureTricks fut, ft;
458
extern struct futureTricks *futp;
459
extern char stri[128];
461
extern FILE *fp, /**fp2, *fp7, *fp11,*/ *fpx;
462
/* Pointers to logs */
464
extern struct ttStoreType * ttStore;
465
extern int lastTTstore;
466
extern int ttCollect;
467
extern int suppressTTlog;
469
EXTERN_C DLLEXPORT int STDCALL SolveBoard(struct deal dl,
470
int target, int solutions, int mode, struct futureTricks *futp, int threadIndex);
471
EXTERN_C DLLEXPORT int STDCALL CalcDDtable(struct ddTableDeal tableDeal,
472
struct ddTableResults * tablep);
475
EXTERN_C DLLEXPORT int STDCALL SolveBoardPBN(struct dealPBN dlpbn, int target,
476
int solutions, int mode, struct futureTricks *futp, int thrId);
477
EXTERN_C DLLEXPORT int STDCALL CalcDDtablePBN(struct ddTableDealPBN tableDealPBN,
478
struct ddTableResults * tablep);
482
EXTERN_C DLLEXPORT int STDCALL SolveAllBoards(struct boardsPBN *bop, struct solvedBoards *solvedp);
483
EXTERN_C DLLEXPORT int STDCALL SolveAllChunks(struct boardsPBN *bop, struct solvedBoards *solvedp, int chunkSize);
484
EXTERN_C DLLEXPORT int STDCALL CalcAllTables(struct ddTableDeals *dealsp, int mode,
485
int trumpFilter[5], struct ddTablesRes *resp, struct allParResults *presp);
486
EXTERN_C DLLEXPORT int STDCALL CalcAllTablesPBN(struct ddTableDealsPBN *dealsp, int mode,
487
int trumpFilter[5], struct ddTablesRes *resp, struct allParResults *presp);
488
EXTERN_C DLLEXPORT int STDCALL CalcPar(struct ddTableDeal tableDeal, int vulnerable,
489
struct ddTableResults * tablep, struct parResults *presp);
490
EXTERN_C DLLEXPORT int STDCALL CalcParPBN(struct ddTableDealPBN tableDealPBN,
491
struct ddTableResults * tablep, int vulnerable, struct parResults *presp);
495
EXTERN_C void InitStart(int gb_ram, int ncores); /* For usage with ctypes in Linux. */
498
EXTERN_C void InitStart(int gb_ram, int ncores);
499
void InitGame(int gameNo, int moveTreeFlag, int first, int handRelFirst, int thrId);
500
void InitSearch(struct pos * posPoint, int depth,
501
struct moveType startMoves[], int first, int mtd, int thrId);
502
int ABsearch(struct pos * posPoint, int target, int depth, int thrId);
503
void Make(struct pos * posPoint, unsigned short int trickCards[4],
504
int depth, int trump, struct movePlyType *mply, int thrId);
505
int MoveGen(struct pos * posPoint, int depth, int trump, struct movePlyType *mply, int thrId);
506
void MergeSort(int n, struct moveType *a);
507
inline int WinningMove(struct moveType * mvp1, struct moveType * mvp2, int trump);
508
inline int WinningMoveNT(struct moveType * mvp1, struct moveType * mvp2);
509
int AdjustMoveList(int thrId);
510
int QuickTricks(struct pos * posPoint, int hand,
511
int depth, int target, int trump, int *result, int thrId);
512
int LaterTricksMIN(struct pos *posPoint, int hand, int depth, int target, int trump, int thrId);
513
int LaterTricksMAX(struct pos *posPoint, int hand, int depth, int target, int trump, int thrId);
514
struct nodeCardsType * CheckSOP(struct pos * posPoint, struct nodeCardsType
515
* nodep, int target, int tricks, int * result, int *value, int thrId);
516
struct nodeCardsType * UpdateSOP(struct pos * posPoint, struct nodeCardsType
518
struct nodeCardsType * FindSOP(struct pos * posPoint,
519
struct winCardType * nodeP, int firstHand,
520
int target, int tricks, int * valp, int thrId);
521
struct nodeCardsType * BuildPath(struct pos * posPoint,
522
struct posSearchType *nodep, int * result, int thrId);
523
void BuildSOP(struct pos * posPoint, long long suitLengths, int tricks, int firstHand, int target,
524
int depth, int scoreFlag, int score, int thrId);
525
struct posSearchType * SearchLenAndInsert(struct posSearchType
526
* rootp, long long key, int insertNode, int *result, int thrId);
527
void Undo(struct pos * posPoint, int depth, struct movePlyType *mply, int thrId);
528
int CheckDeal(struct moveType * cardp, int thrId);
529
int InvBitMapRank(unsigned short bitMap);
530
int InvWinMask(int mask);
531
void ReceiveTTstore(struct pos *posPoint, struct nodeCardsType * cardsP, int target,
532
int depth, int thrId);
533
int NextMove(struct pos *posPoint, int depth, struct movePlyType *mply, int thrId);
534
int DumpInput(int errCode, struct deal dl, int target, int solutions, int mode);
535
void Wipe(int thrId);
536
void AddNodeSet(int thrId);
537
void AddLenSet(int thrId);
538
void AddWinSet(int thrId);
540
void PrintDeal(FILE *fp, unsigned short ranks[4][4]);
542
int SolveAllBoards4(struct boards *bop, struct solvedBoards *solvedp);
543
int SolveAllBoardsN(struct boards *bop, struct solvedBoards *solvedp, int chunkSize);
544
int SolveAllBoards1(struct boards *bop, struct solvedBoards *solvedp);
546
int IsCard(char cardChar);
547
void UpdateDealInfo(int card);
548
int IsVal(char cardChar);