-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.h
56 lines (52 loc) · 1.16 KB
/
Player.h
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
#pragma once
#include "Card.h"
#include <vector>
#include <string>
using std::string;
class Player
{
private:
std::vector<Card> hand;
// Card card1;
// Card card2;
int chip;
int rank; // default rank is 0, high card
bool inGame; // true for in game players, false for folding players
bool onTable; // remove player if onTable is false
string name;
public:
Player() {
std::cerr << "Default player constructor is called..." << std::endl;
}
Player(int hash1, int hash2, int chip, const char* name) {
hand.push_back(Card(hash1));
hand.push_back(Card(hash2));
// this->card1 = Card(hash1);
// this->card2 = Card(hash2);
this->chip = chip;
this->name = name;
onTable = true;
inGame = true;
rank = 0; // high card
}
Card getcard1() const{
return hand[0];
}
Card getcard2() const{
return hand[1];
}
bool isFold() const{
return !inGame;
}
bool isPlaying() const{
return onTable;
}
int getRank() const{
return rank;
}
Card getLargeCard() const;
Card getSmallCard() const;
bool operator>(const Player& other) const;
bool operator==(const Player& other) const;
friend std::ostream& operator<<(std::ostream& os, const Player& p);
};