/* * opponent.cpp * * */ #include "opponent.h" Opponent::Opponent(void) { whatHand[0] = 9; whatHand[1] = 9; whatHand[2] = 9; } void Opponent::dealOpponentCards(void) { /* the cards will be dealt from end of the deck array using deckCurrIndex */ int i, j; for (j = 0; j < numOfOpponents; j++) for (i = 0; i < 5; i++) opponentCards[j][i] = PopCardFromDeck(); } void Opponent::printOpponentCards(void) { int j; for (j = 0; j < numOfOpponents; j++) { cout << "Opponent " << j+1 << ": "; int i; for (i = 0; i < 5; i++) if (opponentCards[j][i]) cout << i+1 << ") " << opponentCards[j][i]->getType() << " "; cout << endl; } } void Opponent::sortOpponentCards(void) { int j; for (j = 0; j < numOfOpponents; j++) sortCards(opponentCards[j]); } Card **Opponent::getOpponentsCards(int whichOpponent) { if (whichOpponent < 1 || whichOpponent > 3) { PRINT_COLOR(ANSI_COLOR_RED, "\ngetOpponentsCards(): opponent number out of bounds!\n"); return NULL; } return opponentCards[whichOpponent-1]; } void Opponent::setOpponentHand(int hand, int whichOpponent) { whatHand[whichOpponent-1] = hand; } int Opponent::getOpponentHand(int whichOpponent) { return whatHand[whichOpponent-1]; }