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

Function loop_solve

library/tests/loop.cpp:31–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30
31void loop_solve(
32 BoardsPBN * bop,
33 SolvedBoards * solvedbdp,
34 DealPBN * deal_list,
35 FutureTricks * fut_list,
36 const int number,
37 const int stepsize)
38{
39#ifdef BATCHTIMES
40 cout << setw(8) << left << "Hand no." <<
41 setw(25) << right << "Time" << "\n";
42#endif
43
44 for (int i = 0; i < number; i += stepsize)
45 {
46 int count = (i + stepsize > number ? number - i : stepsize);
47
48 bop->no_of_boards = count;
49 for (int j = 0; j < count; j++)
50 {
51 bop->deals[j] = deal_list[i + j];
52 bop->target[j] = -1;
53 bop->solutions[j] = 3;
54 bop->mode[j] = 1;
55 // (no-op)
56 }
57
58 timer.start(count);
59 int ret;
60 if ((ret = SolveAllChunks(bop, solvedbdp, 1)) != RETURN_NO_FAULT)
61 {
62 cout << "loop_solve: i " << i << ", return " << ret << "\n";
63 exit(0);
64 }
65 timer.end();
66
67#ifdef BATCHTIMES
68 timer.print_running(i+count, number);
69#endif
70
71 for (int j = 0; j < count; j++)
72 {
73 if (compare_FUT(solvedbdp->solved_board[j], fut_list[i + j]))
74 continue;
75
76 cout << "loop_solve: i " << i << ", j " << j << ": " <<
77 "Difference\n\n";
78 print_FUT(solvedbdp->solved_board[j]);
79 cout << "\n";
80 print_FUT(fut_list[i+j]);
81 cout << "\n";
82 }
83 }
84
85#ifdef BATCHTIMES
86 cout << "\n";
87#endif
88

Callers 1

real_mainFunction · 0.85

Calls 6

SolveAllChunksFunction · 0.85
compare_FUTFunction · 0.85
print_FUTFunction · 0.85
startMethod · 0.80
endMethod · 0.80
print_runningMethod · 0.80

Tested by

no test coverage detected