static void goodmove (enum EPlayer player, unsigned m) { printplayer (OTHER(player)); wprintw (_wmsg, "have %u %s%s.\n", _hand[OTHER(player)][m], c_CardNames[m], _hand[OTHER(player)][m] == 1 ? "" : "'s"); _hand[player][m] += _hand[OTHER(player)][m]; _hand[OTHER(player)][m] = 0; if (_hand[player][m] == SUITS) { printplayer (player); wprintw (_wmsg, "made a book of %s's!\n", c_CardNames[m]); chkwinner (player); } chkwinner (OTHER(player)); printplayer (player); waddstr (_wmsg, "get another guess!\n"); }
void goodmove(int player, int move, int *hand, int *opphand) { printplayer(OTHER(player)); (void)printf("have %d %s%s.\n", opphand[move], cards[move], opphand[move] == 1 ? "": "'s"); hand[move] += opphand[move]; opphand[move] = 0; if (hand[move] == CARDS) { printplayer(player); (void)printf("made a book of %s's!\n", cards[move]); chkwinner(player, hand); } chkwinner(OTHER(player), opphand); printplayer(player); (void)printf("get another guess!\n"); }
static unsigned drawcard (enum EPlayer player) { unsigned card = _deck[--_decksz]; ++_hand[player][card]; if (player == USER || _hand[player][card] == SUITS) { printplayer(player); wprintw (_wmsg, "drew %s", c_CardNames[card]); if (_hand[player][card] == SUITS) { wprintw (_wmsg, " and made a book of %s's.\n", c_CardNames[card]); chkwinner (player); } else waddstr (_wmsg, ".\n"); } return card; }
int drawcard(int player, int *hand) { int card; ++hand[card = deck[--curcard]]; if (player == USER || hand[card] == CARDS) { printplayer(player); (void)printf("drew %s", cards[card]); if (hand[card] == CARDS) { (void)printf(" and made a book of %s's!\n", cards[card]); chkwinner(player, hand); } else (void)printf(".\n"); } return(card); }