int main()
{
  srand(time(NULL));
  Dealer dealer;

  dealer.shuffle();


  dealer.show_list();
  dealer.is_empty();

  return 0;
}
Exemple #2
0
//  'main' test driver for card and dealer classes
int main() {


    // empty deck
    deque<Card> cards;

    // add the hearts...
    for(short v=1; v<=13; v++) {
        Card c(v,Card::HEARTS);
        cards.push_back(c);
    }
    // add the spades...
    for(short v=1; v<=13; v++) {
        Card c(v,Card::SPADES);
        cards.push_back(c);
    }
    // add the diamonds...
    for(short v=1; v<=13; v++) {
        Card c(v,Card::DIAMONDS);
        cards.push_back(c);
    }
    // add the clubs...
    for(short v=1; v<=13; v++) {
        Card c(v,Card::CLUBS);
        cards.push_back(c);
    }

    // create the dealer, give him the cards
    Dealer* dealer = new Dealer(cards);

    for(int i=0; i < 53 ; i ++) {
        try {

            printf("shuffling...\n");
            dealer->shuffle();

            printf("current deck state: (%d cards left)\n",dealer->deck_size());
            dealer->show_cards();

            Card c = dealer->deal_one_card();
            printf("Dealt card: %d,%c \n",c.getValue(),Card::enum2string(c.getSuit()));
        }
        catch (char const* e) {
            printf("%s\n\n", e);
        }
    }

    delete dealer;
    return 0;
}