-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmcts_engine.h
27 lines (22 loc) · 877 Bytes
/
mcts_engine.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
#include <iostream>
#include <vector>
#include <random>
#include "tree_node.h"
#include "connect_four_board.h"
using namespace std;
class MCTSEngine {
private:
int max_iterations;
double max_time;
static const double Cp;
TreeNode* descendTree(TreeNode* tree_node, mt19937_64& random_engine, ConnectFourBoard* current_game_state);
TreeNode* expandTree(TreeNode* a_node, mt19937_64& random_engine, ConnectFourBoard* current_game_state);
TreeNode* selectBestChild(TreeNode* a_node);
Move selectBestMoveRoot(TreeNode* the_root);
double doRandomPlayout(TreeNode* a_node, ConnectFourBoard& a_state, mt19937_64& random_engine, const player& moving_player);
void backupNegamax(TreeNode* a_node, double a_reward);
Move selectExpandingMove(TreeNode* a_node, mt19937_64& random_engine);
public:
MCTSEngine();
Move calculateMove(ConnectFourBoard* a_board);
};