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

Method Strength

library/src/system/scheduler.cpp:708–731  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

706
707
708int Scheduler::Strength(const Deal& dl) const
709{
710 // If the strength in all suits is evenly split, then the
711 // "strength" returned is close to 0. Maximum is 49.
712
713 const unsigned sp = (dl.remainCards[0][0] | dl.remainCards[2][0]) >> 2;
714 const unsigned he = (dl.remainCards[0][1] | dl.remainCards[2][1]) >> 2;
715 const unsigned di = (dl.remainCards[0][2] | dl.remainCards[2][2]) >> 2;
716 const unsigned cl = (dl.remainCards[0][3] | dl.remainCards[2][3]) >> 2;
717
718 const int hsp = highCards[sp];
719 const int hhe = highCards[he];
720 const int hdi = highCards[di];
721 const int hcl = highCards[cl];
722
723 int dev = (hsp >= 14 ? hsp - 14 : 14 - hsp) +
724 (hhe >= 14 ? hhe - 14 : 14 - hhe) +
725 (hdi >= 14 ? hdi - 14 : 14 - hdi) +
726 (hcl >= 14 ? hcl - 14 : 14 - hcl);
727
728 if (dev >= 50) dev = 49;
729
730 return dev;
731}
732
733
734int Scheduler::Fanout(const Deal& dl) const

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected