MCPcopy Create free account
hub / github.com/dds-bridge/dds / print_hand

Function print_hand

examples/hands.cpp:493–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491#define DDS_HAND_LINES 12
492
493auto print_hand(char title[],
494 unsigned int remainCards[DDS_HANDS][DDS_SUITS]) -> void
495{
496 int c, h, s, r;
497 char text[DDS_HAND_LINES][DDS_FULL_LINE];
498
499 for (int l = 0; l < DDS_HAND_LINES; l++)
500 {
501 memset(text[l], ' ', DDS_FULL_LINE);
502 text[l][DDS_FULL_LINE - 1] = '\0';
503 }
504
505 for (h = 0; h < DDS_HANDS; h++)
506 {
507 int offset, line;
508 if (h == 0)
509 {
510 offset = DDS_HAND_OFFSET;
511 line = 0;
512 }
513 else if (h == 1)
514 {
515 offset = 2 * DDS_HAND_OFFSET;
516 line = 4;
517 }
518 else if (h == 2)
519 {
520 offset = DDS_HAND_OFFSET;
521 line = 8;
522 }
523 else
524 {
525 offset = 0;
526 line = 4;
527 }
528
529 for (s = 0; s < DDS_SUITS; s++)
530 {
531 c = offset;
532 for (r = 14; r >= 2; r--)
533 {
534 if ((remainCards[h][s] >> 2) & bit_map_rank_[r])
535 text[line + s][c++] = static_cast<char>(card_rank_chars_[r]);
536 }
537
538 if (c == offset)
539 text[line + s][c++] = '-';
540
541 if (h != 3)
542 text[line + s][c] = '\0';
543 }
544 }
545 printf("%s", title);
546 char dashes[80];
547 int l = static_cast<int>(strlen(title)) - 1;
548 for (int i = 0; i < l; i++)
549 dashes[i] = '-';
550 dashes[l] = '\0';

Callers 6

mainFunction · 0.85
mainFunction · 0.85
print_pbn_handFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected