| 304 | |
| 305 | |
| 306 | bool parse_FUT( |
| 307 | const vector<string>& list, |
| 308 | FutureTricks * fut) |
| 309 | { |
| 310 | if (list.size() < 2) |
| 311 | { |
| 312 | cout << "PBN list does not have 2+ elements: " << list.size() << endl; |
| 313 | return false; |
| 314 | } |
| 315 | |
| 316 | if (! get_head_element(list[0], "FUT")) |
| 317 | return false; |
| 318 | if (! get_int_element(list[1], fut->cards, "FUT cards")) |
| 319 | return false; |
| 320 | |
| 321 | if (static_cast<int>(list.size()) != 4 * fut->cards + 2) |
| 322 | { |
| 323 | cout << "PBN list does not have right length: " << list.size() << endl; |
| 324 | return false; |
| 325 | } |
| 326 | |
| 327 | const unsigned nu = static_cast<unsigned>(fut->cards); |
| 328 | for (unsigned c = 0; c < nu; c++) |
| 329 | if (! get_int_element(list[c+2], fut->suit[c], "FUT suit")) |
| 330 | return false; |
| 331 | |
| 332 | for (unsigned c = 0; c < nu; c++) |
| 333 | if (! get_int_element(list[c+nu+2], fut->rank[c], "FUT rank")) |
| 334 | return false; |
| 335 | |
| 336 | for (unsigned c = 0; c < nu; c++) |
| 337 | if (! get_int_element(list[c+2*nu+2], fut->equals[c], "FUT equals")) |
| 338 | return false; |
| 339 | |
| 340 | for (unsigned c = 0; c < nu; c++) |
| 341 | if (! get_int_element(list[c+3*nu+2], fut->score[c], "FUT score")) |
| 342 | return false; |
| 343 | |
| 344 | return true; |
| 345 | } |
| 346 | |
| 347 | |
| 348 | bool parse_TABLE( |
no test coverage detected