-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhumanplayer.cpp
More file actions
61 lines (44 loc) · 998 Bytes
/
humanplayer.cpp
File metadata and controls
61 lines (44 loc) · 998 Bytes
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
56
57
58
59
60
61
#include "crt.h"
#include "humanplayer.h"
Human::Human() {}
Card Human::playACard(int cardNum) {
int counter(1);
myHand.firstCard();
while(!myHand.isAtEnd() && counter < myHand.getLength() && counter < cardNum)
{
myHand.nextCard();
++counter;
}
return myHand.removeCard();
}
Card Human::checkCard(int cardNum) {
int counter(1);
myHand.firstCard();
while(!myHand.isAtEnd() && counter < myHand.getLength() && counter < cardNum)
{
myHand.nextCard();
++counter;
}
return myHand.lookAtCard();
}
int Human::GetLength() {
return myHand.getLength();
}
void Human::printHand(int x, int y) {
int count(1);
myHand.firstCard();
while(!(myHand.isAtEnd()))
{
GotoXY(x, y);
cout<<count<<": "<<myHand.lookAtCard().toString()<<endl<<flush;
myHand.nextCard();
++y;
++count;
}
}
void Human::addCard(Card card) {
myHand.addACard(card);
}
bool Human::iAmAWinner() {
return (myHand.getLength() == 0);
}