-
Notifications
You must be signed in to change notification settings - Fork 1
/
ai.h
35 lines (30 loc) · 915 Bytes
/
ai.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
#pragma once
#include "board.h"
struct TranspositionEntry
{
int type;
int score;
int depth;
};
typedef uint64_t HashValue;
typedef std::unordered_map<int, std::unordered_map<int, std::unordered_map<int, HashValue>>> ZobristTable;
typedef std::unordered_map<HashValue, TranspositionEntry> TranspositionTable;
class Ai
{
private:
int color;
int leafnodes;
std::map<int,int> cutoffs;
ZobristTable zobristtable;
TranspositionTable tt;
public:
Ai();
Ai(int color);
PieceBoard getMove(Board board, const int &aitime);
private:
std::tuple<int, PieceBoard> alphaBetaNegaMax(Board board, int depth, int color, int alpha, int beta);
void orderMoves(PieceBoardVector &childnodes, const int &color);
void initZobristTable();
HashValue getHashValue(const PieceBoard &pb, const int &turn);
void addCutoff(const int &depth);
};