blob: 022e26cae28cb2236b4130b064fc79ee56ad4a4c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/*
* opponent.cpp
*
*
*/
#include "opponent.h"
Opponent::Opponent(void) : whatHand(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];
}
|