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

Function example_without_context

examples/calc_par_context_example.cpp:24–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23
24void example_without_context()
25{
26 printf("\n=== Par Calculation (Traditional Approach) ===\n\n");
27
28 auto start_time = std::chrono::high_resolution_clock::now();
29
30 for (int handno = 0; handno < 3; handno++)
31 {
32 DdTableResults ddtable;
33 set_table(&ddtable, handno);
34
35 ParResults pres;
36 int res = Par(&ddtable, &pres, vulnerability_[handno]);
37
38 if (res == RETURN_NO_FAULT)
39 {
40 const char* suit_name =
41 (trump_suit_[handno] == 0 ? "♠" :
42 trump_suit_[handno] == 1 ? "♥" :
43 trump_suit_[handno] == 2 ? "♦" :
44 trump_suit_[handno] == 3 ? "♣" : "NT");
45
46 printf("Hand %d (%s): Par score = %s\n",
47 handno + 1,
48 suit_name,
49 pres.par_score[0]);
50 }
51 }
52
53 auto end_time = std::chrono::high_resolution_clock::now();
54 auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(
55 end_time - start_time).count();
56 printf("\nTime (traditional): %lld ms\n\n", static_cast<long long>(elapsed));
57}
58
59
60void example_with_context()

Callers 1

mainFunction · 0.85

Calls 2

set_tableFunction · 0.85
ParFunction · 0.85

Tested by

no test coverage detected