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

Method InitHighCards

library/src/system/scheduler.cpp:54–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52
53
54void Scheduler::InitHighCards()
55{
56 // highCards[i] is a point value of a given suit holding i.
57 // This can be HCP, for instance. Currently it is close to
58 // 6 - 4 - 2 - 1 - 0.5 for A-K-Q-J-T, but with 6.5 for the ace
59 // in order to make the sum come out to 28, an even number, so
60 // that the average number is an integer.
61
62 highCards.resize(1 << 13);
63 const unsigned pA = 1 << 12;
64 const unsigned pK = 1 << 11;
65 const unsigned pQ = 1 << 10;
66 const unsigned pJ = 1 << 9;
67 const unsigned pT = 1 << 8;
68
69 for (unsigned suit = 0; suit < (1 << 13); suit++)
70 {
71 int j = 0;
72 if (suit & pA) j += 13;
73 if (suit & pK) j += 8;
74 if (suit & pQ) j += 4;
75 if (suit & pJ) j += 2;
76 if (suit & pT) j += 1;
77 highCards[suit] = j;
78 }
79}
80
81
82#ifdef DDS_SCHEDULER

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected