forked from lean-poker/poker-player-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.h
143 lines (120 loc) · 1.85 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#ifndef PLAYER_H
#define PLAYER_H
#include "json.h"
//////////////////////////////////
//START
enum class ConditionType
{
CARDS,
POSITION,
ROUND,
ACTION,
NOT_ACTION,
ACTION_ON_POS,
BB_HIGHER,
BB_LOWER,
MORE_PLAYER,
LESS_PLAYER,
};
enum class CardType
{
_2,
_3,
_4,
_5,
_6,
_7,
_8,
_9,
_10,
J,
Q,
K,
A,
HIGH_CARD,
LOW_PAIR,
MID_PAIR,
TOP_PAIR,
TWO_PAIRS,
DRILL,
STRAIGHT,
FLUSH,
FULL_HOUSE,
POKER,
STRAIGHT_FLUSH,
ROYAL_FLUSH,
SUITED,
SEPARATOR,
};
enum class CardColor
{
SPADES,
CLUBS,
HEARTS,
DIAMONDS,
};
enum class PositionType
{
B,
SB,
BB,
UTG,
CO,
D,
};
enum class RoundType
{
PREFLOP,
FLOP,
TURN,
RIVER,
};
enum class ActionType
{
NO_ACTION,
FOLD,
CHECK,
CALL,
RAISE_1,
RAISE_2,
RAISE_3,
RAISE_4,
BET_HALF_POT,
ALL_IN,
};
//END of Enums
//////////////////////////////////
struct Card {
CardType type;
CardColor color;
};
struct GameState {
int small_blind;
int stack;
int player_num;
int call_value;
int half_pot;
bool has_A;
bool has_pair;
ActionType action;
PositionType position;
RoundType round;
std::vector<Card> hand_cards;
std::vector<Card> comm_cards;
};
class HandEvaluator{
public:
bool isHigherOrEqual(const GameState ¤tState, std::vector<CardType> rangeVec);
static bool selfTest();
private:
bool checkInRange(std::vector<CardType> handVec, std::vector<CardType> rangeVec);
};
class Player
{
public:
static const char* VERSION;
static int betRequest(json::Value game_state);
static void showdown(json::Value game_state);
static bool fillState(GameState& gs, json::Value game_state);
};
#endif