| 221 | |
| 222 | |
| 223 | void SetDealTables( |
| 224 | SolverContext& ctx) |
| 225 | { |
| 226 | auto thrp = ctx.thread(); |
| 227 | unsigned int topBitRank = 1; |
| 228 | unsigned int topBitNo = 2; |
| 229 | |
| 230 | // Initialization of the rel structure is inspired by |
| 231 | // a solution given by Thomas Andrews. |
| 232 | |
| 233 | // rel[aggr].abs_rank[absolute rank][suit].hand is the hand |
| 234 | // (N = 0, E = 1 etc.) which holds the absolute rank in |
| 235 | // the suit characterized by aggr. |
| 236 | // rel[aggr].abs_rank[absolute rank][suit].rank is the |
| 237 | // relative rank of that card. |
| 238 | |
| 239 | for (int s = 0; s < DDS_SUITS; s++) |
| 240 | { |
| 241 | for (int ord = 1; ord <= 13; ord++) |
| 242 | { |
| 243 | thrp->rel[0].abs_rank[ord][s].hand = -1; |
| 244 | thrp->rel[0].abs_rank[ord][s].rank = 0; |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | // handLookup[suit][absolute rank] is the hand (N = 0 etc.) |
| 249 | // holding the absolute rank in suit. |
| 250 | |
| 251 | int handLookup[DDS_SUITS][15]; |
| 252 | for (int s = 0; s < DDS_SUITS; s++) |
| 253 | { |
| 254 | for (int r = 14; r >= 2; r--) |
| 255 | { |
| 256 | handLookup[s][r] = 0; |
| 257 | for (int h = 0; h < DDS_HANDS; h++) |
| 258 | { |
| 259 | if (thrp->suit[h][s] & bit_map_rank[r]) |
| 260 | { |
| 261 | handLookup[s][r] = h; |
| 262 | break; |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | { |
| 269 | ctx.trans_table()->init(handLookup); |
| 270 | } |
| 271 | |
| 272 | RelRanksType * relp; |
| 273 | for (unsigned int aggr = 1; aggr < 8192; aggr++) |
| 274 | { |
| 275 | if (aggr >= (topBitRank << 1)) |
| 276 | { |
| 277 | /* Next top bit */ |
| 278 | topBitRank <<= 1; |
| 279 | topBitNo++; |
| 280 | } |
no test coverage detected