-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathai.h
54 lines (38 loc) · 996 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef _ATAXX_AI_HPP_
#define _ATAXX_AI_HPP_
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <vector>
#include <utility>
#include "chessboard.h"
namespace AI
{
class State
{
public:
int x;
int y;
int v;
State(int _x = 0, int _y = 0, int _v = 0);
bool operator<(const State &that) const;
};
const int TL = int(0.9 * CLOCKS_PER_SEC);
extern clock_t t;
extern int p;
__attribute__((always_inline)) inline void Checkmax(int &a, int b)
{
a = a > b ? a : b;
return;
}
__attribute__((always_inline)) inline void Checkmin(int &a, int b)
{
a = a < b ? a : b;
return;
}
int AlphaBeta(ChessBoard g, int d, int a, int b, bool m);
void FirstStep(ChessBoard g, std::vector<State> &f, int d);
State BetaAlpha(ChessBoard g, State o, int d);
void Step(ChessBoard g, int p, int l, std::pair<int, int> &x, std::pair<int, int> &y);
}
#endif