-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCheckers.h
90 lines (71 loc) · 2 KB
/
Checkers.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef Checkers_H
#define Checkers_H
#include "EdAccess.h"
// ------------------------- defines
#define WHITE 1
#define BLACK 2
#define KING 4
#define OFF 0xf0
#define CHANGE_COLOR 3
#define WHITE_MAN (WHITE)
#define WHITE_KING (WHITE | KING)
#define BLACK_MAN (BLACK)
#define BLACK_KING (BLACK | KING)
#define OP_CHECKER(x) (Board[x] & (stm ^ CHANGE_COLOR))
#define MOVE_BUFFER_LEN 409600
#define WIN 32767
#define ED_WIN 30000
#define MAX_DEPTH 128
#define MAN_VALUE 100
#define KING_VALUE 300
// ------------------------- structures
struct Move {
unsigned from;
unsigned to;
bool promotion;
unsigned cap_sq[12];
unsigned cap_type[12];
};
// ------------------------- variables
extern bool StopRequest;
extern bool AnalyseMode;
extern int stm;
extern unsigned Board[45];
extern double PerftNodes;
extern Move *MP;
extern Move MoveBuffer[MOVE_BUFFER_LEN];
extern Move PV[MAX_DEPTH][MAX_DEPTH];
extern double Nodes;
extern unsigned Map_32_to_45[32];
extern unsigned Map_64_to_45[64];
extern unsigned Pieces;
extern EdAccess *ED;
extern unsigned EdPieces;
extern bool EdNocaptures;
extern bool Reversible[MAX_DEPTH];
typedef void (__stdcall *PF_SearchInfo)(int score, int depth, int speed, char *pv, char *cm);
extern PF_SearchInfo pfSearchInfo;
typedef void (__stdcall *PF_SearchInfoEx)(char *score, char *depth, char *speed, char **pv, char *cv);
extern PF_SearchInfoEx pfSearchInfoEx;
// ------------------------- prototypes
void NewGame();
void StrToMove(char *s, Move *m);
void MoveToStr(Move *m, char *s);
void SetupBoard(char *p);
void SetTimeControl(int base, int inc);
void SetTime(int time, int op_time);
void Init();
void Perft(unsigned depth);
void GenerateCaptures();
void GenerateAllMoves();
//void MakeMove(char *s);
void MakeMove(Move *m, unsigned ply);
void UnmakeMove(Move *m);
void PrintBoard();
void StartTimer();
int GetTimeElaps();
int Eval();
Move RootSearch();
bool CheckTime();
int EdProbe();
#endif