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

Method UpdateStatsEntry

library/src/moves/moves.cpp:967–997  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

965}
966
967auto Moves::UpdateStatsEntry(moveStatsType &stat, const int findex,
968 const int hit, const int len) const -> void {
969 bool found = false;
970 int fno = 0;
971 for (int i = 0; i < stat.nfuncs; i++) {
972 if (stat.list[i].findex == findex) {
973 found = true;
974 fno = i;
975 break;
976 }
977 }
978
979 moveStatType *funp;
980 if (found) {
981 funp = &stat.list[fno];
982 funp->count++;
983 funp->sumHits += hit;
984 funp->sumLengths += len;
985 } else {
986 // Internal invariant: nfuncs must not exceed array size
987 assert(stat.nfuncs < static_cast<int>(MgType::SIZE) &&
988 "UpdateStatsEntry: nfuncs overflow");
989
990 funp = &stat.list[stat.nfuncs++];
991
992 funp->count++;
993 funp->findex = findex;
994 funp->sumHits += hit;
995 funp->sumLengths += len;
996 }
997}
998
999auto Moves::RegisterHit(const int trick, const int relHand) -> void {
1000 const MovePlyType &list = moveList[trick][relHand];

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected