|
| 1 | + |
| 2 | +/* First index: 0 nonvul, 1 vul. Second index: tricks down */ |
| 3 | +int DOUBLED_SCORES[2][14] = |
| 4 | +{ |
| 5 | + { 0, 100, 300, 500, 800, 1100, 1400, 1700, |
| 6 | + 2000, 2300, 2600, 2900, 3200, 3500 }, |
| 7 | + { 0, 200, 500, 800, 1100, 1400, 1700, 2000, |
| 8 | + 2300, 2600, 2900, 3200, 3500, 3800 } |
| 9 | +}; |
| 10 | + |
| 11 | +/* First index is contract number, |
| 12 | + 0 is pass, 1 is 1C, ..., 35 is 7NT. |
| 13 | + Second index is 0 nonvul, 1 vul. */ |
| 14 | + |
| 15 | +int SCORES[36][2] = |
| 16 | +{ |
| 17 | + { 0, 0}, |
| 18 | + { 70, 70}, { 70, 70}, { 80, 80}, { 80, 80}, { 90, 90}, |
| 19 | + { 90, 90}, { 90, 90}, { 110, 110}, { 110, 110}, { 120, 120}, |
| 20 | + { 110, 110}, { 110, 110}, { 140, 140}, { 140, 140}, { 400, 600}, |
| 21 | + { 130, 130}, { 130, 130}, { 420, 620}, { 420, 620}, { 430, 630}, |
| 22 | + { 400, 600}, { 400, 600}, { 450, 650}, { 450, 650}, { 460, 660}, |
| 23 | + { 920, 1370}, { 920, 1370}, { 980, 1430}, { 980, 1430}, { 990, 1440}, |
| 24 | + {1440, 2140}, {1440, 2140}, {1510, 2210}, {1510, 2210}, {1520, 2220} |
| 25 | +}; |
| 26 | + |
| 27 | +/* Second index is contract number, 0 .. 35. |
| 28 | + First index is vul: none, only defender, only declarer, both. */ |
| 29 | + |
| 30 | +int DOWN_TARGET[36][4] = |
| 31 | +{ |
| 32 | + {0,0,0,0}, |
| 33 | + {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, |
| 34 | + {0,0,0,0}, {0,0,0,0}, {1,0,1,0}, {1,0,1,0}, {1,0,1,0}, |
| 35 | + {1,0,1,0}, {1,0,1,0}, {1,0,1,0}, {1,0,1,0}, {2,1,3,2}, |
| 36 | + {1,0,1,0}, {1,0,1,0}, {2,1,3,2}, {2,1,3,2}, {2,1,3,2}, |
| 37 | + {2,1,3,2}, {2,1,3,2}, {2,1,3,2}, {2,1,3,2}, {2,1,3,2}, |
| 38 | + {4,3,5,4}, {4,3,5,4}, {4,3,6,5}, {4,3,6,5}, {4,3,6,5}, |
| 39 | + {6,5,8,7}, {6,5,8,7}, {6,5,8,7}, {6,5,8,7}, {6,5,8,7} |
| 40 | +}; |
| 41 | + |
| 42 | +int FLOOR_CONTRACT[36] = |
| 43 | +{ |
| 44 | + 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, |
| 45 | + 1, 2, 3, 4, 15, 1, 2, 18, 19, 15, |
| 46 | + 21, 22, 18, 19, 15, 26, 27, 28, 29, 30, |
| 47 | + 31, 32, 33, 34, 35 |
| 48 | +}; |
| 49 | + |
| 50 | +char NUMBER_TO_CONTRACT[36][3] = |
| 51 | +{ |
| 52 | + "0", |
| 53 | + "1C", "1D", "1H", "1S", "1N", |
| 54 | + "2C", "2D", "2H", "2S", "2N", |
| 55 | + "3C", "3D", "3H", "3S", "3N", |
| 56 | + "4C", "4D", "4H", "4S", "4N", |
| 57 | + "5C", "5D", "5H", "5S", "5N", |
| 58 | + "6C", "6D", "6H", "6S", "6N", |
| 59 | + "7C", "7D", "7H", "7S", "7N" |
| 60 | +}; |
| 61 | + |
| 62 | +char NUMBER_TO_PLAYER[4][2] = { "N", "E", "S", "W" }; |
| 63 | + |
| 64 | +/* First index is vul: none, both, NS, EW. |
| 65 | + Second index is vul (0, 1) for NS and then EW. */ |
| 66 | +int VUL_LOOKUP[4][2] = { {0, 0}, {1, 1}, {1, 0}, {0, 1} }; |
| 67 | + |
| 68 | +/* First vul is declarer (not necessarily NS), second is defender. */ |
| 69 | +int VUL_TO_NO[2][2] = { {0, 1}, {2, 3} }; |
| 70 | + |
| 71 | + |
| 72 | +/* Maps DDS order (S, H, D, C, NT) to par order (C, D, H, S, NT). */ |
| 73 | +int DENOM_ORDER[5] = { 3, 2, 1, 0, 4 }; |
| 74 | + |
| 75 | + |
| 76 | +struct data_type { |
| 77 | + int primacy; |
| 78 | + int highest_making_no; |
| 79 | + int dearest_making_no; |
| 80 | + int dearest_score; |
| 81 | + int vul_no; |
| 82 | +}; |
| 83 | + |
| 84 | +struct list_type { |
| 85 | + int score; |
| 86 | + int dno; |
| 87 | + int no; |
| 88 | + int tricks; |
| 89 | + int down; |
| 90 | +}; |
| 91 | + |
| 92 | + |
| 93 | +#define BIGNUM 9999 |
| 94 | +#define DEBUG 1 |
| 95 | + |
| 96 | + |
| 97 | +void survey_scores( |
| 98 | + struct ddTableResults * tablep, |
| 99 | + int dealer, |
| 100 | + int vul_by_side[2], |
| 101 | + struct data_type * data, |
| 102 | + int * num_candidates, |
| 103 | + struct list_type list[2][5]); |
| 104 | + |
| 105 | +void best_sacrifice( |
| 106 | + struct ddTableResults * tablep, |
| 107 | + int side, |
| 108 | + int no, |
| 109 | + int dno, |
| 110 | + int dealer, |
| 111 | + struct list_type list[2][5], |
| 112 | + int sacr[5][5], |
| 113 | + int * best_down); |
| 114 | + |
| 115 | +void sacrifices_as_text( |
| 116 | + struct ddTableResults * tablep, |
| 117 | + int side, |
| 118 | + int dealer, |
| 119 | + int best_down, |
| 120 | + int no_decl, |
| 121 | + int dno, |
| 122 | + struct list_type list[2][5], |
| 123 | + int sacr[5][5], |
| 124 | + char results[10][10], |
| 125 | + int * res_no); |
| 126 | + |
| 127 | +void reduce_contract( |
| 128 | + int * no, |
| 129 | + int sac_vul, |
| 130 | + int down, |
| 131 | + int * plus); |
| 132 | + |
| 133 | +void contract_as_text( |
| 134 | + struct ddTableResults * tablep, |
| 135 | + int side, |
| 136 | + int no, |
| 137 | + int dno, |
| 138 | + int down, |
| 139 | + char str[10]); |
| 140 | + |
| 141 | +void sacrifice_as_text( |
| 142 | + int no, |
| 143 | + int pno, |
| 144 | + int down, |
| 145 | + char str[10]); |
| 146 | + |
| 147 | + |
0 commit comments