| 216 | #ifndef DEALER_PAR_ENGINE_ONLY |
| 217 | |
| 218 | int STDCALL SidesParBin( |
| 219 | DdTableResults const * tablep, |
| 220 | ParResultsMaster sidesRes[2], |
| 221 | int vulnerable) |
| 222 | { |
| 223 | |
| 224 | /* vulnerable 0: None 1: Both 2: NS 3: EW */ |
| 225 | |
| 226 | /* The code for calculation of par score / contracts is based upon the |
| 227 | perl code written by Matthew Kidd ACBLmerge. He has kindly given me |
| 228 | permission to include a C++ adaptation in DDS. */ |
| 229 | |
| 230 | /* The Par function computes the par result and contracts. */ |
| 231 | |
| 232 | |
| 233 | int denom_conv[5] = { 4, 0, 1, 2, 3 }; |
| 234 | /* Preallocate for efficiency. These hold result from last direction |
| 235 | (N-S or E-W) examined. */ |
| 236 | int j, k, m, isvul; |
| 237 | int current_side, both_sides_once_flag, denom_max = 0, max_lower; |
| 238 | int new_score_flag, sc1, sc2, sc3; |
| 239 | int prev_par_denom = 0, prev_par_tricks = 0; |
| 240 | int denom_filter[5] = { 0, 0, 0, 0, 0 }; |
| 241 | int no_filtered[2] = { 0, 0 }; |
| 242 | int no_of_denom[2]; |
| 243 | int best_par_score[2]; |
| 244 | int best_par_sacut[2]; |
| 245 | best_par_type best_par[5][2]; /* 1st index order number. */ |
| 246 | |
| 247 | int ut = 0, t1, t2, tt, score, dr, tu, tu_max, t3[5], t4[5], n; |
| 248 | par_suits_type par_suits[5]; |
| 249 | |
| 250 | int par_denom[2] = { -1, -1 }; /* 0-4 = NT,S,H,D,C */ |
| 251 | int par_tricks[2] = { 6, 6 }; /* Initial "contract" beats 0 NT */ |
| 252 | int par_score[2] = { 0, 0 }; |
| 253 | int par_sacut[2] = { 0, 0 }; /* Undertricks for sacrifice (0 if not sac) */ |
| 254 | |
| 255 | |
| 256 | /* Find best par result for N-S (i==0) or E-W (i==1). These will |
| 257 | nearly always be the same, but when we have a "hot" situation |
| 258 | they will not be. */ |
| 259 | |
| 260 | for (int i = 0; i <= 1; i++) |
| 261 | { |
| 262 | /* Start with the with the offensive side (current_side = 0) and |
| 263 | alternate between sides seeking the to improve the result for the |
| 264 | current side.*/ |
| 265 | |
| 266 | no_filtered[i] = 0; |
| 267 | for (m = 0; m <= 4; m++) |
| 268 | denom_filter[m] = 0; |
| 269 | |
| 270 | current_side = 0; |
| 271 | both_sides_once_flag = 0; |
| 272 | while (1) |
| 273 | { |
| 274 | |
| 275 | /* Find best contract for current side that beats current contract. |
no test coverage detected