forked from official-clockwork/Clockwork
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_perft.cpp
More file actions
69 lines (60 loc) · 1.88 KB
/
Copy pathtest_perft.cpp
File metadata and controls
69 lines (60 loc) · 1.88 KB
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
#include <iostream>
#include <sstream>
#include <string_view>
#include <tuple>
#include <vector>
#include "perft.hpp"
#include "position.hpp"
#include <cstdlib>
#include <iomanip>
using namespace Clockwork;
int main() {
std::vector<std::tuple<std::string_view, std::vector<u64>>> cases{{
{
"r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1",
{{1, 48, 2039, 97862, 4085603, 193690690}},
},
{
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
{{1, 20, 400, 8902, 197281, 4865609, 119060324}},
},
{
"8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 1",
{{1, 14, 191, 2812, 43238, 674624, 11030083}},
},
{
"r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1",
{{1, 6, 264, 9467, 422333, 15833292}},
},
{
"rnbq1k1r/pp1Pbppp/2p5/8/2B5/8/PPP1NnPP/RNBQK2R w KQ - 1 8",
{{1, 44, 1486, 62379, 2103487, 89941194}},
},
{
"r4rk1/1pp1qppp/p1np1n2/2b1p1B1/2B1P1b1/P1NP1N2/1PP1QPPP/R4RK1 w - - 0 10",
{{1, 46, 2079, 89890, 3894594, 164075551}},
},
{
"1bbrnkqr/pp1p1ppp/2p1p3/1n6/5P2/3Q4/PPPPP1PP/NBBRNK1R w HDhd - 2 9",
{{1, 36, 891, 31075, 781792, 26998966}},
},
{
"2r1kr2/8/8/8/8/8/8/1R2K1R1 w GBfc - 0 1",
{{1, 22, 501, 11459, 264663, 6236222, 149271720}},
},
}};
g_frc = true;
for (auto [fen, results] : cases) {
Position position = *Position::parse(fen);
std::cout << fen << ":" << std::endl;
for (usize depth = 0; depth < results.size(); depth++) {
u64 value = perft(position, depth);
std::cout << depth << ":" << value << std::endl;
if (value != results[depth]) {
split_perft(position, depth);
std::exit(1);
}
}
}
return 0;
}