-
Notifications
You must be signed in to change notification settings - Fork 1
/
tournament.h
49 lines (38 loc) · 1.35 KB
/
tournament.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
#ifndef POKER_TOURNAMENT_H_
#define POKER_TOURNAMENT_H_
#include <vector>
namespace poker {
class Tournament {
public:
struct Results {
Results(int num_players)
: finishes(num_players, std::vector<double>(num_players, 0)),
equity(num_players, 0.0) {}
std::vector<std::vector<double>> finishes;
std::vector<double> equity;
};
Tournament(const std::vector<double>& prizes, const std::vector<int>& stacks)
: num_players_(stacks.size()), prizes_(prizes), stacks_(stacks) {}
// RunOne runs a tournament one time.
// Return:
// The finishing positions for each player, 0-offset.
std::vector<int> RunOne();
// RunN: run a tournament N times returing collective results.
// Args:
// n_trials: number of runs of tournament.
// Return:
// Results containing counts of finishing positions for each player
// and total equity won in N tournaments.
Results RunN(int n_trials);
const int NumPlayers() const { return num_players_; }
const std::vector<double> Prizes() const { return prizes_; }
const std::vector<int> StartingStacks() const { return stacks_; }
private:
// Worker to run in thread for RunN
Results RunNImpl(int n_trials, int thread);
const int num_players_;
const std::vector<double> prizes_;
const std::vector<int> stacks_;
};
} // namespace poker
#endif /* POKER_TOURNAMENT_H_ */