/* Kamil Kaminski * NetID: kkamin8 * * CS340 * Project 1, Poker Game * * */ #include "game.h" int main(int argc, char *argv[]) { /* seed rand() */ srand((unsigned int ) time(NULL)); /* pokerGame instance */ Game *pokerGame = new Game(); PRINT_COLOR(ANSI_COLOR_GREEN, "\tWelcome to Poker Game\n\n"); /* number of opponents user input */ pokerGame->askForNumberOfOpponents(); /* pokerGame loop */ bool quit = false; while (!quit) { cout << "\nThe deck is being shuffled" << endl; pokerGame->shufflePile(); #ifdef DEBUG PRINT_COLOR(ANSI_COLOR_CYAN, "\ndebug: deck after shuffle\n"); pokerGame->printPile(); #endif cout << "\nDealing cards to the user" << endl; pokerGame->dealUserCards(); pokerGame->sortUserCards(); cout << "Cards in your hand: "; pokerGame->printUserCards(); cout << "Number of same cards: " << pokerGame->numOfSameCards(pokerGame->getUserCards()) << endl; if ( pokerGame->pairOrBetter(pokerGame->getUserCards())) cout << "User has pair or better" << endl; struct countAndSuit userCountAndSuit = pokerGame->numOfSameSuit(pokerGame->getUserCards()); cout << "Top suit: " << *pokerGame->suits[userCountAndSuit.whatSuit] << ", count: " << userCountAndSuit.count << endl; if ( pokerGame->doWeHaveAnAce(pokerGame->getUserCards()) ) cout << "You have an Ace!" << endl; pokerGame->discardAndDraw( pokerGame->getUserCards(), 2, 3 ); cout << "Cards in your hand after discarding: "; pokerGame->printUserCards(); cout << "\nDealing cards to opponent(s)" << endl; pokerGame->dealOpponentCards(pokerGame->numOfOpponents); pokerGame->sortOpponentCards(pokerGame->numOfOpponents); cout << "Opponents' cards:" << endl; pokerGame->printOpponentCards(pokerGame->numOfOpponents); #ifdef DEBUG cout << "Computer's AI" << endl; pokerGame->opponentAI(pokerGame->getOpponentsCards(1)); pokerGame->printOpponentCards(pokerGame->numOfOpponents); #endif #ifdef DEBUG PRINT_COLOR(ANSI_COLOR_CYAN, "\ndebug: deck after being delt to opponents and user\n"); pokerGame->printPile(); #endif /* ask to repeat the game and reset the deck of cards */ pokerGame->repeatGame(&quit); pokerGame->resetDeck(); } cout << "\nThank you for playing\n" << pokerGame->handsPlayed << ": Hands played\n" << pokerGame->handsWon << ": Hands won" << endl; delete pokerGame; PRINT_COLOR(ANSI_COLOR_CYAN, "\tBye!\n"); return 0; }