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

Method MakeGroups

library/src/system/scheduler.cpp:224–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222
223
224void Scheduler::MakeGroups(const Boards& bds)
225{
226 Deal const * dl;
227 listType * lp;
228
229 for (int b = 0; b < numHands; b++)
230 {
231 dl = &bds.deals[b];
232
233 int strain = dl->trump;
234
235 unsigned dlXor =
236 dl->remainCards[0][0] ^
237 dl->remainCards[1][1] ^
238 dl->remainCards[2][2] ^
239 dl->remainCards[3][3];
240
241 int key = static_cast<int>(((dlXor >> 2) ^ (dlXor >> 6)) & 0x7f);
242
243 hands[b].spareKey = static_cast<int>(
244 (dl->remainCards[1][0] << 17) ^
245 (dl->remainCards[2][1] << 11) ^
246 (dl->remainCards[3][2] << 5) ^
247 (dl->remainCards[0][3] >> 2));
248
249 for (int h = 0; h < DDS_HANDS; h++)
250 for (int s = 0; s < DDS_SUITS; s++)
251 hands[b].remainCards[h][s] = dl->remainCards[h][s];
252
253 hands[b].NTflag = (strain == 4 ? 1 : 0);
254 hands[b].first = dl->first;
255 hands[b].strain = strain;
256 hands[b].fanout = Scheduler::Fanout(* dl);
257 // hands[b].strength = Scheduler::Strength(* dl);
258
259 lp = &list[strain][key];
260
261 if (lp->first == -1)
262 {
263 lp->first = b;
264 lp->last = b;
265 lp->length = 1;
266
267 group[numGroups].strain = strain;
268 group[numGroups].hash = key;
269 numGroups++;
270 }
271 else
272 {
273 int l = lp->last;
274 hands[l].next = b;
275
276 lp->last = b;
277 lp->length++;
278 }
279 }
280}
281

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected