-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTesting.h
114 lines (95 loc) · 2.27 KB
/
Testing.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#ifndef TESTING_H
#define TESTING_H
#include <iostream>
#include <algorithm>
#include <fstream>
#include <random>
#include <memory>
#include <numeric>
#include <stack>
#include <climits>
#include <string>
#include <chrono>
#include <boost/tokenizer.hpp>
#include "misc.h"
#include "Move.h"
#include "ZobristHash.h"
#include "Data.h"
#include "defines.h"
#include "AI.h"
#include "Board.h"
using namespace std;
typedef pair<string, string> stringpair;
class UnitTest
{
public:
// Test game mechanics and calculations
UnitTest();
// Intrinsics testing
void testDefines() const;
void testIntrinsics() const;
// Move generation testing
void testGenerationAlgorithms();
void specialTest(); // unspecified custom test
void testHashing();
void testMagic();
private:
void testPawnFill();
void testCastling();
void testEnpassent();
void testProm();
};
class Benchmark
{
public:
Benchmark();
void testPerft(int maxdepth);
void perftTestSuite();
void perft(int maxDepth, const int targetDepth, color startColor);
private:
Board testBoard;
// perft statistics
long perftNodeCount;
long perftEPCount;
long perftMoveCount;
long perftCheckmateCount;
long totalPerftMoveCount;
long totalTotalPerftMoveCount;
};
class DataBaseTest
{
public:
DataBaseTest();
void start_Bratko_Kopec_Test();
private:
int targetDepth;
Move getBestTestMove(color forPlayer);
Move distributeNegaMax(color forPlayer);
int NegaMax(int alpha, int beta, int depth, color aiColor, color side);
Board testBoard;
ZobristHash transposition_hash;
long evalcnt, negaMaxCnt, storedBoards, hashAccess, moveCnt;
};
class SearchTest
{
public:
SearchTest();
void test(); // Custom function
Move getBestMove(color forPlayer);
private:
int NegaMax(int alpha, int beta, int depth, int ply, color side);
int QuiescenceSearch(int alpha, int beta, int ply, color side);
void nextMove(MoveList&, const MoveList::iterator&, color);
void extractPrincipalVariation(const U64& startKey, int maxPrintDepth, color aiColor);
template<color side> bool isCheckmate();
void invertChessboard(); // For evaluation symmetry testing
int targetDepth;
Board board;
ZobristHash transpositionHash;
PVTable pvTable;
long evalcnt, negaMaxCnt, storedBoards, hashAccess, moveCnt;
double finished;
double ordering;
color aiColor;
};
#endif