-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreflop_equi_dist.h
73 lines (59 loc) · 2.24 KB
/
preflop_equi_dist.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
#ifndef GTO_PREFLOP_EQUI_DIST_H_
#define GTO_PREFLOP_EQUI_DIST_H_
#include <unordered_map>
#include "equi_dist_interface.h"
#include "preflop_range.h"
namespace GTO {
// Implementation of pre-flop equity distribution.
class PreflopEquiDist : public EquiDistInterface<PreflopHand> {
public:
PreflopEquiDist();
~PreflopEquiDist() {}
virtual double
Equity(const PreflopHand& hero, const PreflopHand& villain) const
{
Pair<PreflopHand> p(hero, villain);
return equity_.count(p) > 0 ? equity_.at(p) : -1;
}
virtual Array<double> LUT(
const std::vector<PreflopHand>& hands1,
const std::vector<PreflopHand>& hands2) const;
private:
void
set_equity(const char *h, const char *v, double EQ)
{
equity_[Pair<PreflopHand>(PreflopHand(h),PreflopHand(v))] = EQ;
}
const char *preflop_equity_file_ = "proto/preflop-matchups.txt";
std::unordered_map<Pair<PreflopHand>, double> equity_;
};
// Represents the number of match-ups suit combos between two pre-flop
// hands.
class SuitCombos {
public:
SuitCombos();
~SuitCombos() {}
// Return the number of possible match-ups between a hand
// represented as "hero" and all the hands represented as
// "villain" in pre-flop if we take into account their suits.
unsigned short
NumCombos(const PreflopHand& hero, const PreflopHand& villain) const
{
return combos_.at(Pair<PreflopHand>(hero, villain));
}
// Return a lookup table represented as an array such that
// Array.get(i, j) == NumCombos(hands1[i], hands2[j]).
Array<unsigned short> LUT(
const std::vector<PreflopHand>& hands1,
const std::vector<PreflopHand>& hands2) const;
private:
void
set_combos(const char *h, const char *v, unsigned short n)
{
combos_[Pair<PreflopHand>(PreflopHand(h), PreflopHand(v))] = n;
}
const char *preflop_combos_file_ = "proto/preflop-combos.txt";
std::unordered_map<Pair<PreflopHand>, unsigned short> combos_;
};
} // namespace GTO
#endif // !GTO_PREFLOP_EQUI_DIST_H_