-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomputerPlayer.h
40 lines (35 loc) · 1007 Bytes
/
computerPlayer.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
//
// Created by James on 30/09/15.
//
#ifndef HEX_COMPUTERPLAYER_H
#define HEX_COMPUTERPLAYER_H
#include <memory>
#include <utility>
#include "board.h"
#include "aiStrategy.h"
#include "aiStrategyEnum.h"
#include "pureMonteCarlo.h"
#include "monteCarloTreeSearch.h"
#include "player.h"
class ComputerPlayer : public Player
{
private:
TileColour colour_;
std::unique_ptr<AIStrategy> strategy_;
bool is_first_;
public:
ComputerPlayer(TileColour colour, AIStrategyEnum strategy, bool is_first) : colour_(colour), is_first_(is_first)
{
if (strategy == AIStrategyEnum::PURE_MC)
{
strategy_ = std::unique_ptr<AIStrategy>(new PureMonteCarlo());
}
else if (strategy == AIStrategyEnum::MCTS)
{
strategy_ = std::unique_ptr<AIStrategy>(new MonteCarloTreeSearch());
}
}
std::pair<int, int> nextMove(Board &board) const override;
bool playPieRule(Board &board) const override;
};
#endif //HEX_COMPUTERPLAYER_H