-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
32 lines (29 loc) · 1009 Bytes
/
main.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
#include "CounterFactualRegretMinimizer.h"
#include "KuhnPokerGame.h"
#include "RPSGame.h"
/**
* Example usage of performing CFR. The following code solves the game of
* Kuhn poker (https://en.wikipedia.org/wiki/Kuhn_poker) and
* periodically saves the strategy in the output file
*
* @param outputFile the file to store checkpoints in
*/
static void solveKuhnPoker(std::string outputFile) {
auto game = std::make_shared<KuhnPokerGame>();
CounterFactualRegretMinimizer<KuhnPokerAction> trainer(game);
trainer.solve(outputFile, 100000, 10000);
}
/**
* Performs CFR on Rock-Paper-Scissors. The strategy will be periodically
* stored in the output file
*
* @param outputFile the file to store checkpoints in
*/
static void solveRPS(std::string outputFile) {
const auto game = std::make_shared<RPSGame>();
CounterFactualRegretMinimizer<RPSAction> trainer(game);
trainer.solve(outputFile, 100000, 10000);
}
int main(int argc, char *argv[]) {
solveRPS("rps_strategy.txt");
}