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

Function QuickTricksPartnerHandTrump

library/src/quick_tricks.cpp:889–1024  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

887
888
889int QuickTricksPartnerHandTrump(
890 const int hand,
891 Pos& tpos,
892 const int cutoff,
893 const int depth,
894 const int countLho,
895 const int countRho,
896 const int lhoTrumpRanks,
897 const int rhoTrumpRanks,
898 const int countOwn,
899 const int countPart,
900 const int suit,
901 const int qtricks,
902 const int commSuit,
903 const int commRank,
904 int& res,
905 SolverContext& ctx)
906{
907 /* res=0 Continue with same suit.
908 res=1 Cutoff.
909 res=2 Continue with next suit. */
910
911 res = 1;
912 int qt = qtricks;
913 if (((countLho != 0) || (lhoTrumpRanks == 0)) &&
914 ((countRho != 0) || (rhoTrumpRanks == 0)))
915 {
916 tpos.win_ranks[depth][suit] |=
917 bit_map_rank[tpos.winner[suit].rank];
918
919 tpos.win_ranks[depth][commSuit] |= bit_map_rank[commRank];
920
921 qt++; /* A trick can be taken */
922 if (qt >= cutoff)
923 return qt;
924 if ((countLho <= 1) &&
925 (countRho <= 1) &&
926 (countOwn <= 1) &&
927 (lhoTrumpRanks == 0) &&
928 (rhoTrumpRanks == 0))
929 {
930 qt += countPart - 1;
931 if (qt >= cutoff)
932 return qt;
933 res = 2;
934 return qt;
935 }
936 }
937
938 if (tpos.second_best[suit].hand == partner[hand])
939 {
940 /* Second best found in partners hand */
941 if ((lhoTrumpRanks == 0) && (rhoTrumpRanks == 0))
942 {
943 /* Opponents have no trump */
944 tpos.win_ranks[depth][suit] |=
945 bit_map_rank[tpos.second_best[suit].rank];
946

Callers 1

QuickTricksFunction · 0.85

Calls 1

threadMethod · 0.80

Tested by

no test coverage detected