| 843 | #endif |
| 844 | |
| 845 | int rawscore(int denom, int tricks, int isvul) |
| 846 | { |
| 847 | int game_bonus, level, score; |
| 848 | |
| 849 | /* Computes score for undoubled contract or a doubled contract with |
| 850 | for a given number of undertricks. These are the only possibilities |
| 851 | for a par contract (aside from a passed out hand). |
| 852 | |
| 853 | denom - 0 = NT, 1 = Spades, 2 = Hearts, 3 = Diamonds, 4 = Clubs |
| 854 | (same order as results from double dummy solver); -1 undertricks |
| 855 | tricks - For making contracts (7-13); otherwise, number of |
| 856 | undertricks. |
| 857 | isvul - True if vulnerable */ |
| 858 | |
| 859 | if (denom == -1) |
| 860 | { |
| 861 | if (isvul) |
| 862 | return -300 * tricks + 100; |
| 863 | if (tricks <= 3) |
| 864 | return -200 * tricks + 100; |
| 865 | return -300 * tricks + 400; |
| 866 | } |
| 867 | else |
| 868 | { |
| 869 | level = tricks - 6; |
| 870 | game_bonus = 0; |
| 871 | if (denom == 0) |
| 872 | { |
| 873 | score = 10 + 30 * level; |
| 874 | if (level >= 3) |
| 875 | game_bonus = 1; |
| 876 | } |
| 877 | else if ((denom == 1) || (denom == 2)) |
| 878 | { |
| 879 | score = 30 * level; |
| 880 | if (level >= 4) |
| 881 | game_bonus = 1; |
| 882 | } |
| 883 | else |
| 884 | { |
| 885 | score = 20 * level; |
| 886 | if (level >= 5) |
| 887 | game_bonus = 1; |
| 888 | } |
| 889 | if (game_bonus) |
| 890 | { |
| 891 | score += (isvul ? 500 : 300); |
| 892 | } |
| 893 | else |
| 894 | score += 50; |
| 895 | |
| 896 | if (level == 6) |
| 897 | { |
| 898 | score += (isvul ? 750 : 500); |
| 899 | } |
| 900 | else if (level == 7) |
| 901 | { |
| 902 | score += (isvul ? 1500 : 1000); |