| 789 | } |
| 790 | |
| 791 | int QtricksLeadHandNT( |
| 792 | const int hand, |
| 793 | Pos& tpos, |
| 794 | const int cutoff, |
| 795 | const int depth, |
| 796 | const int countLho, |
| 797 | const int countRho, |
| 798 | int& lhoTrumpRanks, |
| 799 | int& rhoTrumpRanks, |
| 800 | const bool commPartner, |
| 801 | const int commSuit, |
| 802 | const int countOwn, |
| 803 | const int countPart, |
| 804 | const int suit, |
| 805 | const int qtricks, |
| 806 | const int trump, |
| 807 | int& res) |
| 808 | { |
| 809 | /* res=0 Continue with same suit. |
| 810 | res=1 Cutoff. |
| 811 | res=2 Continue with next suit. */ |
| 812 | |
| 813 | res = 1; |
| 814 | int qt = qtricks; |
| 815 | tpos.win_ranks[depth][suit] |= |
| 816 | bit_map_rank[tpos.winner[suit].rank]; |
| 817 | |
| 818 | qt++; |
| 819 | if (qt >= cutoff) |
| 820 | return qt; |
| 821 | if ((trump == suit) && ((!commPartner) || (suit != commSuit))) |
| 822 | { |
| 823 | lhoTrumpRanks = std::max(0, lhoTrumpRanks - 1); |
| 824 | rhoTrumpRanks = std::max(0, rhoTrumpRanks - 1); |
| 825 | } |
| 826 | |
| 827 | if ((countLho <= 1) && (countRho <= 1) && (countPart <= 1)) |
| 828 | { |
| 829 | qt += countOwn - 1; |
| 830 | if (qt >= cutoff) |
| 831 | return qt; |
| 832 | res = 2; |
| 833 | return qt; |
| 834 | } |
| 835 | |
| 836 | if (tpos.second_best[suit].hand == hand) |
| 837 | { |
| 838 | tpos.win_ranks[depth][suit] |= |
| 839 | bit_map_rank[tpos.second_best[suit].rank]; |
| 840 | qt++; |
| 841 | if (qt >= cutoff) |
| 842 | return qt; |
| 843 | if ((trump == suit) && ((!commPartner) || (suit != commSuit))) |
| 844 | { |
| 845 | lhoTrumpRanks = std::max(0, lhoTrumpRanks - 1); |
| 846 | rhoTrumpRanks = std::max(0, rhoTrumpRanks - 1); |
| 847 | } |
| 848 | if ((countLho <= 2) && (countRho <= 2) && (countPart <= 2)) |