MCPcopy Create free account
hub / github.com/dds-bridge/dds / main

Function main

examples/solve_board.cpp:21–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19
20
21auto main() -> int
22{
23 Deal dl;
24 FutureTricks fut2, // solutions == 2
25 fut3; // solutions == 3
26
27 int target;
28 int solutions;
29 int mode;
30 int threadIndex = 0;
31 int res;
32 char line[80];
33 bool match2;
34 bool match3;
35
36#if defined(__linux) || defined(__APPLE__)
37 SetMaxThreads(0);
38#endif
39
40 for (int handno = 0; handno < 3; handno++)
41 {
42 dl.trump = trump_suit_[handno];
43 dl.first = first_hand_[handno];
44
45 dl.currentTrickSuit[0] = 0;
46 dl.currentTrickSuit[1] = 0;
47 dl.currentTrickSuit[2] = 0;
48
49 dl.currentTrickRank[0] = 0;
50 dl.currentTrickRank[1] = 0;
51 dl.currentTrickRank[2] = 0;
52
53 for (int h = 0; h < DDS_HANDS; h++)
54 for (int s = 0; s < DDS_SUITS; s++)
55 dl.remainCards[h][s] = holdings_[handno][s][h];
56
57 target = -1;
58 solutions = 3;
59 mode = 0;
60 res = SolveBoard(dl, target, solutions, mode, &fut3, threadIndex);
61
62 if (res != RETURN_NO_FAULT)
63 {
64 ErrorMessage(res, line);
65 printf("DDS error: %s\n", line);
66 }
67
68 match3 = compare_future_tricks(&fut3, handno, solutions);
69
70 solutions = 2;
71 res = SolveBoard(dl, target, solutions, mode, &fut2, threadIndex);
72 if (res != RETURN_NO_FAULT)
73 {
74 ErrorMessage(res, line);
75 printf("DDS error: %s\n", line);
76 }
77
78 match2 = compare_future_tricks(&fut2, handno, solutions);

Callers

nothing calls this directly

Calls 6

SetMaxThreadsFunction · 0.85
ErrorMessageFunction · 0.85
compare_future_tricksFunction · 0.85
print_handFunction · 0.85
print_future_tricksFunction · 0.85
SolveBoardFunction · 0.50

Tested by

no test coverage detected