-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstructure.cpp
34 lines (29 loc) · 945 Bytes
/
structure.cpp
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
#include "structure.h"
#include <algorithm>
#include <cassert>
#include <cmath>
namespace poker {
std::vector<int> Stacks(int highest, int chips, int num_players) {
int n = 0;
std::vector<int> players(num_players);
double c = static_cast<double>(num_players) / highest;
std::generate(players.begin(), players.end(), [ highest, c, &n ]()->int {
auto stack = static_cast<int>(chips * c * std::exp(-(n++ * c)) + 0.5);
return std::max(stack, 1);
});
return players;
}
std::vector<double> TournamentPayouts(double prizepool,
const std::string& tournament_type,
int num_players) {
std::vector<double> prizes;
if (tournament_type == "sng-10") {
// At least two opponents, three total
assert(num_players > 1);
for (auto p : {0.5, 0.3, 0.2}) {
prizes.emplace_back(p * prizepool);
}
}
return prizes;
}
} // namespace poker